How to save/restore global variables in android even when os kill application

前端 未结 2 1319
再見小時候
再見小時候 2020-12-31 19:12

In android,Google recommends us to save the global variables in Application. But there is a problem, if the android os kill the application because of low of memory, the app

2条回答
  •  我在风中等你
    2020-12-31 19:54

    As per new guidelines always Consider using apply() instead of commit on shared preferences. Whereas commit blocks and writes its data to persistent storage immediately, apply will handle it in the background and will not hamper your other ongoing work.

提交回复
热议问题