我有问题的部分如下:
public class MainActivity extends BaseActivity implements
OnContactsInteractionListener, OnAdModeListener {
private SharedPreferences sp;
private SharedPreferences.Editor ed;
...
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
sp = this.getSharedPreferences("me.name",
MODE_PRIVATE);
ed = sp.edit();
private boolean parseIntent(Intent intent) {
if (intent.getAction().equals("SHOW_PHONE_CALL_LIST")
&& sp.getBoolean("SHOW_SECOND", false)) {
try {
goToPage(1);
int random = sp.getInt("RANDOM", 9999);
counterAdsAndLoad("2", random);
//ed is editor object
ed.putString("MP3PATH", "");
ed.putBoolean("SHOW_SECOND", false);
ed.commit()
return true;
} catch (Exception e) {
e.printStackTrace();
}
}
ed.remove("RANDOM").commit();
return false;
}
由于不合理的不良行为,我进行了调试,我看到了以下内容: if 条件为真,正如我所料,第二秒后commit()
程序跳转到return false
.
可能是什么原因?