I've to invoke 3rd page of view-pager using FragmentPagerAdapter so I've passed value 3 to this fragment activity which loads view-pager. But It invokes still first page of page-viewer. Any solution will be appreciated.
This class is deprecated. Switch to androidx. viewpager2. widget.
FragmentPagerAdapter is used exactly like FragmentStatePagerAdapter . It only differs in how it unloads your fragments when they are no longer needed (Figure 11.4). With FragmentStatePagerAdapter , your unneeded fragment is destroyed.
You can use startActivityForResult(or broadcast/receiver) to get the result from the activity. Then use adapter. notifyDataSetChanged to refresh the fragment.
ViewPager in Android allows the user to flip left and right through pages of data. In our android ViewPager application we'll implement a ViewPager that swipes through three views with different images and texts.
just use
mViewPager.setCurrentItem(2);
if you want to go to 3rd page, because the index starts with 0.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With