I have two different activities. The first launches the second one. In the second activity, I call System.exit(0) in order to force the application to close, bu
You are wrong. There is one way to kill an application. In a class with super class Application, we use some field, for example, killApp. When we start the splash screen (first activity) in onResume(), we set a parameter for false for field killApp. In every activity which we have when onResume() is called in the end, we call something like that:
if(AppClass.killApp())
finish();
Every activity which is getting to the screen have to call onResume(). When it is called, we have to check if our field killApp is true. If it is true, current activities call finish(). To invoke the full action, we use the next construction. For example, in the action for a button:
AppClass.setkillApplication(true);
finish();
return;