我有9个项目列表,我希望当用户点击共享SharedPreferences中的每个项目保存值时,如果在SharedPreferences中保存值等于例如 我该怎么做才能做到这一点 请帮帮我
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
mSharedPreferences = getApplicationContext().getSharedPreferences("edameh", 0);
SharedPreferences.Editor edit = mSharedPreferences.edit();
if (i == 0) {
Intent intent0 = new Intent(getApplicationContext(),Study.class);
startActivity(intent0);
edit.putString("a", ed);
edit.commit();
}
if (i == 1) {
Intent intent1 = new Intent(getApplicationContext(),Mogh.class);
startActivity(intent1);
edit.putString("b", ed);
edit.commit();
}
用于检查值共享优先级的第二个活动
if (fistActivity.ed=="a"){
}