Hi guys Today I am going to show you how to use ViewPager as a image slide gallery. In this example you can swipe left or right to view image.

I simply put the images to drawable folder and display on it ViewPager

First you need to create the PagerAdapter

ImageAdapter.java

Then create the xml file and add the ViewPager in layout

activity_main.xml

Then create main Activity and create the instance of ViewPager

MainActivity.java

Final Output