I am using a Fragment class.
I add it using
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
Search fragment = new Search(maincontrolActivity.this);
fragmentTransaction.add(R.id.mainLayout,fragment , "MY_FRAG");
fragmentTransaction.commit();
this.FragmentObject = fragment
when I do refresh the control,I recall this code but by passing this.FragmentObject but I think it be garbage collected because the = refere to the same object , and when say add, it free the old fragement which is the same
so do I need a deep copy or any way to refresh ?
any idea
Ok. So what I would do is have an
Interfacedefined and have eachFragmentregister with theActivityfor a callback when the refresh button is clicked. Then in the fragment itself have it refresh its data. If that means getting new data, switch to aProgressBar, get the data from the server, and repopulate theViews. Here is an entire article on creatingInterfaces inActivitiesand callingFragments from them.Here is roughly what your code will look like…
The
Activity:The
Fragment: