How to refresh a fragment ?
See original GitHub issueThe user can add or delete the pages himself. In these pages I have an edittext (in fact I have more but it is the same case for all) which is the name of the page. If the user creates a page that it calls “page 1”, deletes it and creates another page immediately after it, which it calls “page 2”, the fragment will display the data on page 1 ".
onCreate method
viewPager = (ViewPager) findViewById(R.id.viewpager);
viewPagerTab = (SmartTabLayout) findViewById(R.id.viewpagertab);
pages = new FragmentPagerItems(this);
// here page.add
adapter = new FragmentPagerItemAdapter(getSupportFragmentManager(), pages){
@Override
public int getItemPosition(Object object) {
return POSITION_NONE;
}
};
viewPager.setAdapter(adapter);
viewPagerTab.setViewPager(viewPager);
My method for create a new fragment
pages.add(FragmentPagerItem.of(
Pref.getList_points().get(Pref.get_size() - 1).getName(),
FragmentConfigurationPoints.class,
new Bundler().putInt("param1", Pref.get_size() - 1).get()
));
adapter.notifyDataSetChanged( );
viewPagerTab.setViewPager(viewPager);
Issue Analytics
- State:
- Created 7 years ago
- Comments:7
Top Results From Across the Web
Refresh Fragment at reload - android - Stack Overflow
Go to your navigation graph and find the fragment you want to refresh. Create an action from that fragment to itself. Now you...
Read more >Fragment Refresh | by Taman Neupane - Medium
Today i am gonna talk about fragment communication or simply we can say how to refresh one fragment from another fragment in tab...
Read more >Refresh/Reload/Re instantiate a Fragment in an android tab ...
In Activity: @Override. public void onTabSelected(ActionBar.Tab tab,. FragmentTransaction fragmentTransaction) {. // When the given tab is selected, ...
Read more >Fragment Refresh from Containing Page - Oracle Blogs
Initially the fragment is not aware of the fact that the variable that was passed in when the fragment first rendered has changed....
Read more >Refreshing Fragments | Relay
In order to manually refresh the data for a fragment, we need a query to refetch the fragment under; remember, fragments can't be...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

change FragmentPagerItemAdapter to FragmentStatePagerItemAdapter solve my issue
@dengxingwen