In the process of using the sharePreferences object, the difference between the apply and commit methods to submit data

apply() is first submitted to the memory (it has atomicity and cannot be interrupted), and then submitted to the database asynchronously, with no return value, and it is impossible to know whether the submission is successful or not, which is more efficient

commit() is directly submitted to the database (with atomicity), with a return value indicating whether the submission was successful or not

Details: https://www.jianshu.com/p/c8d10357c939

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324767025&siteId=291194637