I have seven activities in my application. I have exit button in my first activity. When I am first click on the Exit button then it runs ok…… but when i am on second,third……activities and comes direct to the first activity then the Exit Button took me in the previous activity…..
Button Exit = (Button) findViewById(R.id.close);
Exit.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
finish();
System.exit(1);
}
});
Android is designed in a way that it is not necessary to shut down applications. If you want user to get to home-screen you can just create an intent to show home-screen. Something like this:
intent.addCategory(Intent.CATEGORY_HOME);. No need forSystem.exit(1).