Need help on my page refresh issue when using viewpager. I am using a simple viewpager with a FragmentStatePagerAdapter. All I want to do is access the current fragment / view in order to update some text fragments in my fragment / view. I searched around the forum and found out a few things - One way to deal with this is to set the tag in the instantiateItem () callback back and look for the findViewbyTag view. I could not figure out how to implement this, and I am also not sure if this will work for the FragmentStatePagerAdapter. - I studied other options proposed in different forums, but I can not get them to work.
My code is very similar to android http://developer.android.com/training/animation/screen-slide.html . The basic components are the same (Fragment activity xml with some display components, including textview, viewpager xml with only the presentation pager in it, the fragment class and the main FragmentActivity class). in my FragmentActivity class, I added a pageChangelistener to my viewer so that I can make changes to the text while onPageSelected ().
Any help is appreciated.
Adding code for reference.
Public class myActivity extends FragmentActivity //Variable declarations protected void onCreate(Bundle savedInstanceState) { ViewPager mPager = (ViewPager) findViewById(R.id.pager); mPagerAdapter = new ScreenSlidePagerAdapter(getSupportFragmentManager()); mPager.setAdapter(mPagerAdapter); View CurrView; OnPageChangeListener pageChangelistener = new OnPageChangeListener() { @Override public void onPageSelected(int pageSelected) { doTextViewChnges();
android android-fragments android-viewpager
user1938357
source share