android - Swapping list of fragments inside FragmentStatePagerAdapter -


I'm having trouble swapping the list of pieces inside my FragmentStatePager adapter, and wondering if there are any ideas

  • The main activity includes three tabs (restaurants, reviews, favorites), each has a piece with a list of restaurants
  • Users can make a different Swipe between each tab to see the list
  • The main activity There is a button in the layout when the user presses the button so it will swap with a list of all existing pieces. << li>

    I currently have a new list of pieces with restaurant location map (Google Maps) to view the swipe tab and pager that works with the action bar. There will be three pieces. I have some success in excluding pieces of the map with pieces of the map, but the following problem occurs:

    • When I press the button on the main page, first (the restaurant ) Tab becomes empty.
    • When I swipe on the next tab (review), the tab is populated with a piece of map
    • When I want to hit the third tab (favorites) The tab is empty <

    My setting is the following:

    • The main function of the fragment activity extension and implementation implementation.
    • A restaurant listfragment class is used for the restaurant
    • A restaurant list map for each restaurant for a map of the population map again with different figures Category is used
    • Expanding a tab pager adapter class FragmentStatePagerAdapter

    I have tried almost every post about this topic about stack overflow, but No successful yet Interpretation is not found Does anyone have any ideas? Code is attached below Thanks.

      // Main activity Public square Main: piece activity, actionbars. IDB Listener {// Some general codes here, nothing special // // This button triggers pieces swap Private Zero BindCommands () {ListMapSwitchButton.Click + = (Sender, E) => {_isList =! _isList; ListMapSwitchButton.Text = _isList? RESTAURANTS_MAP_TEXT: RESTAURANTS_LIST_TEXT; MAdapter.SwapListMapFragments (viewPager); }; }} Public Class Tabs Paper Adapter: FragmentState Pager Adapter {Private zero-populated fragments () {_fragments = new list & lt; Restaurant Fragmentbase & gt; () {New restaurant listfragment (), new restaurant listfragment (), new restraintfragment ()}; } Public Zero SwapListampfraagments (ViewPage Pager) {_fragments.Clear (); _fragments.Add (new restaurantmapfragment ()); _fragments.Add (new restaurantmapfragment ()); _fragments.Add (new restaurantmapfragment ()); NotifyDataSetChanged (); Pager Destra Drawing Cache (); } Public override int getitemposition (JavaLanguage.Object Item object) {Return no; } Public override Android App Fragment Getitam (Int Index) {Returns _ Fragments [Index]; } #region Applicable pager adapter public override int number {get {return 3; Note that this code is actually written with Xamarin in Seamer, but syntax differences should be similar to Java except I know that if any additional information Can help 


Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -