I reload / refresh Listfragment ( CfFragment (), PfFragment (), IfFragment () in < Unable / strong> in the code below) When the tab is selected or swiped, someone can tell me where I'm going wrong. My code is working well when it has been created for the first time, but when it is swipe or not selected, if I change anything in the first list then it should affect the fragment of the second list and so much. No one can help me. It will be greatly appreciated. Thank you. }
ActionBar.TabListener {Session session session extends to busy bits of public class; AppSectionsPagerAdapter mAppSectionsPagerAdapter; Static ServiceURL URL; Fixed AlertDialogmanager Warning = New AlertDialog Manager (); ViewPager mViewPager; Crate on Public Zero (Bundle Saved Instantstate) {Super. Secret (Saved Instantstate); SetContentView (R.layout.busy); Session = new session manager (getApplicationContext ()); MAppSectionsPagerAdapter = New AppSectionsPagerAdapter (getSupportFragmentManager ()); Last ActionBeer Actionbars = Matching (); ActionBar.setDisplayHomeAsUpEnabled (true); ActionBar.setNavigationMode (ActionBar.NAVIGATION_MODE_TABS); MViewPager = (Videobject) Find VVBIID (RIDPager); MViewPager.setAdapter (mAppSectionsPagerAdapter); mViewPager.setOnPageChangeListener (New ViewPager.SimpleOnPageChangeListener () {@Override public void onPageSelected (int position) {actionBar.setSelectedNavigationItem (position);}}); For (int i = 0; i & LT; mAppSectionsPagerAdapter.getCount (); i ++) {actionBar.addTab (actionBar.newTab () setText (mAppSectionsPagerAdapter.getPageTitle (i)) setTabListener (it) ..); }} @Override public void onTabUnselected (ActionBar.Tab tab, FragmentTransaction fragmentTransaction) {} @Override public void onTabSelected (ActionBar.Tab tab, FragmentTransaction fragmentTransaction) {mViewPager.setCurrentItem (tab.getPosition ()); //mViewPager.setAdapter (mAppSectionsPagerAdapter); } {@} Auradide Public Declaration {@TargetApi (Build.VERSION_CODES.HONEYCOMB) • Public Static Classes AppSectionsPagerAdapter FragmentPagerAdapter {Public AppSectionsPagerAdapter (FragmentManager fm) {super (fm);} on the @Tower Tab, Fragment Transaction Fragment Transaction. } @ Override Public Fragment Hot Itam (Int'l) {Switch (I) {Case: New CFFGramme is back; Case 1: Return the new PFFragment (); Case 2: Return the new IFragment (); } Return tap; } @ Override Public Inaccount () {Return 3; } Public Charsequence getPageTitle (int position) {Switch (status) {Case 0: Return "Confy"; Case 1: Return "Penny"; Case 2: Return "Insec"; Default: Break; } Return tap; }}
Thursday, 15 January 2015
android - Reload or refresh list fragment when swiped or when tab is selected? -
Receive your appspages page adapter in
as
public static class AppSectionsPagerAdapter extends FragmentStatePagerAdapter
instead of
public static Class AppSectionsPagerAdapter extends FragmentPagerAdapter
Actually, FragmentPagerAdapter
remains piece
is in memory, while FragmentStatePagerAdapter
is deleted And gives them a fresh start as they see And are moving out.
Two more things:
1. Make sure that you not calling Set Risen Instens (true) any of <
code> snippet s, then they re-vamped Will be
2.
Frontend. Setoffscreen Page Limit (0);
In your code.
Edit:
Instead
Activity -> ViewPager - & gt; Pieces
as the structure
activity - & gt; Piece - & gt; ViewPager - & gt; Nested pieces
will ensure that each section
tab changes to refresh. See the post for implementation.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment