Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SharedPreferencesCompat的findApplyMethod这个方法是做什么用的? #1

Open
1242128273wangpeng opened this issue Jun 20, 2016 · 2 comments

Comments

@1242128273wangpeng
Copy link

SharedPreferencesUtils.SharedPreferencesCompat的findApplyMethod这个方法是做什么用的,Editor里面不是有 editor.apply();方法吗?用apply有什么好处呢?apply和commit有什么区别?

@movexmanlife
Copy link
Owner

http://tanqi0508.blog.163.com/blog/static/1883557772012111104326404/

1.apply没有返回值而commit返回boolean表明修改是否提交成功
2.apply是将修改数据原子提交到内存, 而后异步真正提交到硬件磁盘, 而commit是同步的提交到硬件磁盘
3.apply方法不会提示任何失败的提示

这里是其实是默认使用apply进行提交,如果没有apply方法就使用commit进行提交。

@jiqiuyucool
Copy link

clone下来,还没进去就挂掉了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants