Android的内容保存内容、Android

2023-09-12 06:08:22 作者:取暖

我有一个奇怪的问题。正如我在问previous的帖子,我有大量的数据从NET在我的应用程序的到来。问题是,大量的文字和图像ř那里,所以虽然我可以让用户等待汶河点击列表项,但我不想让他等待汶河单击后退按钮。

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.

在我不想重新下载所有的数据的意义;数据1CE下载应予以保留。

In the sense that I don't want to re-download all data; data 1ce downloaded should remain.

其中1是正确的方法?

1 使用它存储所有数据的特殊类......每次我回去使用变量,

1. Using a special class which stores all data... and using the variables each time I go back,

2 有没有专用的保存方法,例如在节能类等数据     本身......如果是,那么请告诉我如何调用保存的实例活动     当回被点击。

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.

推荐答案

通过用户点击后退按钮据我所知,previous活动显示,并在堆栈的顶部返回(见的活动周期)。

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).

这意味着本次活动不被再次创建,但恢复了(除非它被打死的核心,因为其他应用程序需要内存),所以它的字段和属性保持它们的值。 所以,如果你保存你的DATAS在某些领域的活动,你也许能找回自己的价值,并显示它们,而无需重新下载。

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.

当然,你已经访问它们,以避免NPE的情况下活动的首次启动前测试这些领域。

Of course you have to test these fields before accessing them in order to avoid NPE in case of activity first start.

 
精彩推荐
图片推荐