1
How to create a "Quit" button or cause the app to close when using the Smartphone’s "back"?
To develop my application I am using the App Framework intel.
1
How to create a "Quit" button or cause the app to close when using the Smartphone’s "back"?
To develop my application I am using the App Framework intel.
3
First, you need to keep in mind how Android works and Google’s recommendations on app design.
Android is developed so that the user does not worry whether an application is open or closed. The operating system itself decides when to terminate an application based on the memory and processing resources that the system currently has. From the moment the user stops using the application, it enters a queue to be terminated in case of need. Android works like this so a user can quickly change between apps.
There is the method finish()
. You can create a button that directly calls this method, but what it will have is the same effect as using the back button, which is to hide your Activity and leave it in "stop" mode (calling the onStop() method). What really closes Activity is method onDestroy
which must be called somento by the system.
In short, apps for Android do not have and should not have a button get out of. Look at the Google apps (Gmail, Hangout, play music, gplus, Calendar etc) none of them have a quit button.
0
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_HOME);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
Browser other questions tagged android html5 eclipse
You are not signed in. Login or sign up in order to post.
Hello friend, could you explain a little more about your solution?
– Jedaias Rodrigues