Skip to content Skip to sidebar Skip to footer

Load Data From Service Only Once On Fragment

I have a fragment that loads data everytime you click on it, I want its behavior to be in a way that if I clicked on it once and moved to another fragment when I go back to it, it

Solution 1:

Remove your method which is getting results from the server from onCreateView. onCreateView called all time when you replace fragments. Instead do one time work in onCreate.

@Override
public void onCreate(Bundle savedInstance) {
    super.onCreate(savedInstance);
   retrieveConsultantList();
}

Post a Comment for "Load Data From Service Only Once On Fragment"