You have to set Global boolean
variable and set it to true when you successfully login and check it on resume activity of LoginActivity
and start an Intent of MainActivity
. Here is the code..
boolean mainActi = false;
mainActi = true;
@Override
protected void onResume() {
super.onResume();
f(mainActi) {
Intent i1 = new Intent(MainActivity.this,LogIn.class);
startActivity(i1);
mainActi = false;
}
}