I have a weird problem. As I have asked in previous posts, I have a lot of data coming from NET in my app. The problem is that a lot of text and images r there, so though I can make the user wait wen he clicks on a list item, but I don’t want to make him wait wen he clicks the back button.
In the sense that I don’t want to re-download all data; data 1ce downloaded should remain.
Which 1 is the right method?
1. Using a special class which stores all data… and using the variables each time I go back,
or
2. Is there any specific save instance method for saving such data in the class
itself… if it is then do inform me how to call the saved instance Activity
when back is clicked.
By “user clicks the back button” I understand that the previous activity is displayed and returned at the top of the stack (see activity lifecycle).
This mean this activity is not created again, but resumed (unless it was killed by core because other applications need memory), so its fields and attributes keep their values.
So if you store your datas in some activity fields, you might be able to retrieve their values and display them without re-download them.
Of course you have to test these fields before accessing them in order to avoid NPE in case of activity first start.