I am using onPause
for killing application when it goes in background.
@Override
public void onPause(){
super.onPause();
finish();
System.runFinalizersOnExit(true);
System.exit(0);
android.os.Process.killProcess(android.os.Process.myPid());
}
This has two problems:
- Application is still in background.
- When I am in Second or Third or next activity and I press Back key, application exits.
What I really want is to kill the application only when it goes in background.