1.apply没有返回值而commit返回boolean表明修改是否提交成功2.apply是将修改数据原子提交到内存, 而后异步真正提交到硬件磁盘, 而commit是同步的提交到硬件磁盘3.apply方法不会提示任何失败的提示 apply的效率高一些,如果没有必要确认是否提交成功建议使用apply. The SharedPreferences class provides a general framework that allows you to save and retrieve persi…
this的指向问题 一般情况下this对象指向调用函数的对象,全局环境中执行函数this对象指向window. function a(){ console.log(this); //输出函数a中的this对象 } function b(){}; var c={name:"call"}; //定义对象c var c = { getFunc:function(){ return function(){ console.log(this) } } } var cFun = c.getFunc…