0

After a lot of searching, I can not find a solution to my problem.

The summary of my program I ve also checked with a tabhost. It's viewpager viewpager has fragmentpageradapter who get an instance vector fragments, the fragments will identified by their position in the vector. The first fragment instantiates a listefragment using a simpleadapter. The listfragment is loaded with json data oncreate. In the GetView method of simpleadapter, I change a textview in one of the item using a button on the item and a textview which'm part of an instance of this fragmentactivity.

I have listfragment with different json given 4 different positions in my viewpager. When I press the button on my item, my textview and change correct.

My problem When I turn pages in my viewpager and I return to the previous page of my viewpager, all calls to this issue 0 My question how to save and restore the state of the items in my listfragment? Or do I make these?

My Attempts Save and restore the fragment in my listfragment use a static method in the viewholder GetView of simpleadapter I'm turning around ............

Thanks in advance for your help

1 Answers1

0

After a week of research and have posted a question on this great forum. I finally found my problem question. Here is the solution

this.mViewPager = (ViewPager) super.findViewById(R.id.tabviewpager2);
this.mViewPager.setOffscreenPageLimit(this.mPagerAdapter.getCount());

Link stackoverflow Saving Fragment state in ViewPager

link android http://developer.android.com/reference/android/support/v4/view/ViewPager.html#setOffscreenPageLimit%28int%29

Community
  • 1
  • 1