i have 9 item list and i want when user click on each item save value in shared SharedPreferences and in second activity put if value save in SharedPreferences equal for example a how can i do this work please help me
@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();
}
in second activity for check value shared prefrences
if (fistActivity.ed=="a"){
}