I have develop android application,there I have Exit button in menu option.I want exit application and go to home screen when I press exit button. for that I have used
following methods
1.System.exit(0)
2.finish()
3.android.os.Process.killProcess(android.os.Process.myPid())
4.System.runFinalizersOnExit(true);
these all methods direct to application my first page not to home screen.so what should I do for this?? please help me
Firstly close in an android application is frowned upon because the back button and home button are already kinda giving you this functionality.
But if you need to you can do this
When the user wishes to exit all open activities, they should press a button which loads the first Activity that runs when your app starts.
The above code clears all the activities except for first activity. Then put this code inside the first activity’s
onCreate(), to signal when it should self destruct when the ‘Exit‘ message is passed.