Why are fragments not recreated in the viewpager when activity is recreated?

In my application, I use viewpager with tablayout. When the application is in the background for a long time, activity is recreated, but fragments are not recreated, so the data coming from the service is not updated in the user interface.

+4
source share
1 answer

move ui update logic to onResume

@Override
public void onResume() {
    super.onResume();
    // call api for getting data
    // call ui processing method
}
0
source

All Articles