I made an activity with a FragmentPagerAdapter
and some Tabs.
When onResume
is called (The user exits the application and enters it again) I want to update the Fragment. (Connecting to a Web Server)
My problem is when I override onResume
in the Fragment it is also called when the User switches a Tab. I don't want that!
What can I do?
Have you tried other events like "onCreate" and "onStart"?
Another option would be to save a timestamp after getting data from webserver, so every time onResume is fired you check this timestamp to determine if your data needs to be refreshed.
You can do it using:
long timestamp = System.currentTimeMillis();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.