Exit Application

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Exit Application

Postby zahidalinaqvi » Thu Oct 29, 2009 10:46 pm

Hi
How i can exit my application.

i used finish(); but its only exit my current Activity and i want to exit my whole application.

Please reply soon
User avatar
zahidalinaqvi
Developer
Developer
 
Posts: 35
Joined: Mon Aug 11, 2008 8:54 am
Location: Jaipur India

Top

Re: Exit Application

Postby jagtap.jj1 » Fri Oct 30, 2009 5:05 am

Take the help this class
http://developer.android.com/reference/ ... ation.html


zahidalinaqvi wrote:Hi
How i can exit my application.

i used finish(); but its only exit my current Activity and i want to exit my whole application.

Please reply soon
java-android developer
User avatar
jagtap.jj1
Senior Developer
Senior Developer
 
Posts: 124
Joined: Fri Aug 22, 2008 11:52 am
Location: India(Mumbai)

Postby Rahul » Fri Oct 30, 2009 12:45 pm

The life cycle of android works like that.You don't have to exit the application.When user clicks on the home button all activities for that application will still be there on the activity stack.Android automatically finishes them whenever it requires additional memory or after a span of time.

If you want start with the root activity every time you can use android:clearTaskOnLaunch=true.

Refer to these links for details..

http://developer.android.com/guide/topi ... ml#acttask

http://groups.google.com/group/android- ... 55ebfd5799
Rahul
Experienced Developer
Experienced Developer
 
Posts: 89
Joined: Wed Oct 01, 2008 11:16 am

Postby sudheer1437 » Mon Nov 02, 2009 8:54 am

try
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. System.exit(0);
Parsed in 0.030 seconds, using GeSHi 1.0.8.4
sudheer1437
Experienced Developer
Experienced Developer
 
Posts: 79
Joined: Sat Aug 08, 2009 7:42 am
Location: India

Postby azraeal » Mon Nov 02, 2009 7:37 pm

The java system.exit call would be brute forcing it, and inelegant in my opinion. And the Android lifecycle read is important but it doesn't address when the developer would like an explicit "Quit" or "Exit Application" option.

Call finish() from your root activity. This is the activity that you've first entered in your app execution. This should finish the child activities as well.
azraeal
Experienced Developer
Experienced Developer
 
Posts: 71
Joined: Fri Sep 04, 2009 6:34 pm
Location: California

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 3 guests