I am using the following code, MAX is 2 pages. By default the position is 0 and adds a new page to the right. I inflate two layout files.
How can I show the page1 wh
This solution gives the ability of setting default page without interference from outside of the Pager adapter class.
@Override
public Object instantiateItem(ViewGroup container, int position) {
View currentPage = null;
switch(position){
case 0:
currentPage = LayoutInflater.from(context).inflate(R.layout.page0, null)
break;
case 1:
currentPage = LayoutInflater.from(context).inflate(R.layout.page1, null)
///////////// This page will be default ////////////////////
((ViewPager)container).setCurrentItem(position);
////////////////////////////////////////////////////////////
break;
case 2:
currentPage = LayoutInflater.from(context).inflate(R.layout.page2, null)
break;
return currentPage;
}