android - 全局数据储存到Application中,Application在切出软件后被回收,Application中是新建的数据都为空
PHP中文网
PHP中文网 2017-04-17 16:38:23
0
4
593

全局数据储存到Application中,Application在切出软件后被回收,重新打开界面,因为Application中是新建的数据都为空。针对这种情况数据存储在哪里不会被回收

PHP中文网
PHP中文网

认证高级PHP讲师

reply all(4)
洪涛

File, db. Configuration tables, etc. will not work. Remember not to store data in Application. In addition, data can be restored through the life cycle, but it is still recommended to store data with a long life cycle in the form of files. Such as what I mentioned in my appeal.

Not only the global data of Application, but also static global variables will be destroyed. The use of static global variables should be reduced in Android, and even if they are used, attention should be paid to storage and recovery during the life cycle.

黄舟

Database, shareprefrence, file cache, network server, etc. are all stored in the form of file storage. The programs stored in the memory will be released after the program exits

巴扎黑

Databases, sharedpreferences, files, networks, these can be stored persistently. In this way, when starting the application, you only need to read the corresponding content to restore the data display effect

阿神

What the person above said is right

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template