I have 3 activities, each with map fragments. Now I was wondering how I could use hide and show to allow them to stay loaded in the background once the activity is triggered.

Essentially the user starts on Homescreen, loads up rss feed and map fragment then goes to next activity by clicking button. Then he loads up that activity with map fragment. If the user then clicks the back button the Homescreen has to be reloaded and the same if he goes back to the second activity.

How can I have it so when an activity is loaded if the the user travels to different activity the old activity stays active but hidden in the background so the data is already downloaded when he travels back.

有帮助吗?

解决方案

If you must use activities, there is no way you can "hide" it and stay loaded, you'll have to cache the data so when you go back / forward all you have to do is reload the activity with the old data (no delay) and refresh it with an AsynkTask on background.

OR

You could use fragments instead of activities if the content is not very "heavy" and cache the 3 of them

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top