开发者

Will SharedPreference be destroyed if the Context has been destroyed?

开发者 https://www.devze.com 2023-01-06 00:24 出处:网络
Will SharedPreference be destroyed if the Context has been destroye开发者_StackOverflowd? For example, if the Context is an Activity, and this Activity has quit.

Will SharedPreference be destroyed if the Context has been destroye开发者_StackOverflowd?

For example, if the Context is an Activity, and this Activity has quit.

I tried in my code, and the SharedPreference turns to be null, as well as the Context.

I also tried to find some clues in the opensource code, but it's complicated for me.


SharedPreferences are there to store data. So the data should still be here, even if you restart your phone for example. So to answer your question: No, SharedPreferences are not destroyed.

However, to solve your problem you have to post some code.

0

精彩评论

暂无评论...
验证码 换一张
取 消