在我的应用程序中,我正在应用程序上下文中存储一些数据。当我打开4到5个其他应用程序时,我的应用程序数据从上下文中是清除的。有什么办法可以找到我的应用程序数据何时从上下文中清除。
You application context is available to you only when you are using your application, if you leave it will goes for garbage collection.
Background process limit on android-
If you own a device that is lacking in processing power and memory, you can use this feature to limit the number of background process that can run between 0 and 4 processes.
To change your device process limit-
From android documentation -
By default, every application runs in its own Linux process. Android starts the process when any of the application's components need to be executed, then shuts down the process when it's no longer needed or when the system must recover memory for other applications.
You need to use SharedPref to shave your application data.
public static final String PREFS_NAME = "MyPrefsFile";
SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);
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.