I got two activities.....LoginActivity
(Launcher Activity) and MainActivity
. When the app is installed and started the LoginActivity
is invoked and on entering the username and password, it authenticate from a server and starts the MainActivity
. This works fine.
when the app is minimized or Paused using backbutton or homebutton and resumed again i want the app to resume from the MainActivity. How can that be done...I am a beginner...please help!!Thanks.
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;
}
}