SharedPreferences sPref; final String SAVED_TEXT = "saved_text"; public void Check(View view) { sPref = getPreferences(MODE_PRIVATE); int progress = sPref.getInt(SAVED_TEXT, 2); if (progress==2) { Intent intent = new Intent(Main6Activity.this, Main7Activity.class); startActivity(intent); } if (progress==3) { Intent intent = new Intent(Main6Activity.this, Main8Activity.class); startActivity(intent); } if (progress==4) { Intent intent = new Intent(Main6Activity.this, Main9Activity.class); startActivity(intent); } if (progress==5) { Intent intent = new Intent(Main6Activity.this, Main10Activity.class); startActivity(intent); } if (progress==6) { Intent intent = new Intent(Main6Activity.this, Main11Activity.class); startActivity(intent); } if (progress==7) { Intent intent = new Intent(Main6Activity.this, Main12Activity.class); startActivity(intent); } if (progress==8) { Intent intent = new Intent(Main6Activity.this, Main13Activity.class); startActivity(intent); } if (progress==9) { Intent intent = new Intent(Main6Activity.this, Main14Activity.class); startActivity(intent); } if (progress==10) { Intent intent = new Intent(Main6Activity.this, Main15Activity.class); startActivity(intent); } if (progress==11) { Intent intent = new Intent(Main6Activity.this, Main16Activity.class); startActivity(intent); } if (progress==12) { Intent intent = new Intent(Main6Activity.this, Main17Activity.class); startActivity(intent); } if (progress==13) { Intent intent = new Intent(Main6Activity.this, Main18Activity.class); startActivity(intent); } if (progress==14) { Intent intent = new Intent(Main6Activity.this, Main19Activity.class); startActivity(intent); } } public void onClick(View view){ sPref = getPreferences(MODE_PRIVATE); SharedPreferences.Editor ed = sPref.edit(); ed.putInt(SAVED_TEXT, 2); ed.apply(); } PS with spaces and brackets everything is fine. When you click on a button in SAVED_TEXT, variable 2 should be saved, which, when you click on another button, will be read and checked for what this number is, if the resulting variable is equal to 2, for example, then another activity should open, but this does not happen.
Check(View view)method exactly called? Put the method codeLog.d("TEST", "run Check");and check in logcat. - Ivan