Hello! There is a sliding navigation bar + TAB of 3 tabs. Each tab loads its fragment, when switching between tabs, everything loads correctly, but when you click on the side menu tab, you need to reload the current fragment and update the contents of the fragment with new data obtained from the database, I get the data from the database correctly, but I can’t overwrite the fragment. I tried to replace , detach , attach - did not help.
I tried this:
FragmentMainPic fragmentMainPic = (FragmentMainPic) getSupportFragmentManager().findFragmentById(R.id.fragment_main); FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); ft.detach(fragmentMainPic); ft.attach(fragmentMainPic); ft.commit(); Here for some reason fragmentMainPic returns null
and so, here ft loaded, newInstance triggered, but the data is not updated
FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); FragmentMainPic fragmentMainPic = FragmentMainPic.newInstance(1); ft.replace(R.id.fragment_main,new FragmentMainPic ()); ft.commit(); There is a suspicion that somehow you need to be updated through the interface