[ad_1]
MainActivity
btnWriteMarksPage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(idd.dontcomehereAgain==0){
Intent i=new Intent(MainActivity.this,askGs.class);
startActivity(i);
}else if(idd.dontcomehereAgain==1){
Intent i = new Intent(MainActivity.this,WriteMarksActivity.class);
Toast.makeText(MainActivity.this, "write", Toast.LENGTH_SHORT).show();
startActivity(i);
}
}
});
2nd activity
btnNext.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (idd.whichType==1){
Intent ii = new Intent(askGs.this,simpleGs.class);
startActivity(ii);
}else if(idd.whichType==2){
Intent ii = new Intent(askGs.this,otherGr.class);
startActivity(ii);
idd.setDontcomehereAgain(1);
Toast.makeText(askGs.this,"6"+String.valueOf(idd.dontcomehereAgain),Toast.LENGTH_LONG).show();
}
}
});
i wish when the 2nd if statement is executed methood idd.setDontcomehereAgain(0) will turn to idd.setDontcomehereAgain(1), then the 2nd activity will not appear anymore when i click btnWriteMarksPage on the main page. But it seem the methood idd.setDontcomehereAgain(1)reset to 0 again when i restart the app . how do i make the variable stay the same without going to initial value after reopen of app?
[ad_2]