[android-developers] Re: Close Application

2009-08-20 Thread brian.schimmel

I think this will just work fine:

android.os.Process.killProcess(android.os.Process.myPid());

As far as I know, it kills the current DalvikVM right on the spot, so
be careful.

On 10 Aug., 20:49, jhoffman keshis...@gmail.com wrote:
 It really depends on the structure of your app, but one trick you
 might employ is to launch your various activities with
 startActivityForResult(intent, ID);
 and then override onActivityResult to watch for a return value from
 the activity you launched. You can then make decisions about whether
 you should call finish() in the original activity, or whether the user
 just wanted to go back to that original activity without closing the
 entire app.

 Again, without knowing the structure of your app or more details, I
 can't be sure that this is actually going to be helpful to you. If it
 isn't though, feel free to post some specifics! :)

 On Aug 10, 2:36 am, Blackmarket pascal.se...@gmail.com wrote:

  Hi,

  i want to add anexitbutton to the menu, but didn't see an easy way
  to close anapplicationor acces all activities of anapplicationand
  finish them. Is there an easy approach avaible?

  Regards, Pascal


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Close Application

2009-08-20 Thread Dianne Hackborn
This does NOT exit the application, it just kills its current process, and
if the user is down in a couple activities, all this ends up doing is
removing the top activity (because it went away without saving its state)
and goes to the previous one.  And if there are other things running in the
process such as services, they will be started right back up.

Also, notice how NO standard applications in android have a quit command?
This is not a standard part of the android UI model, and there is no need
for it.

On Thu, Aug 20, 2009 at 5:27 AM, brian.schimmel 
brian.schim...@googlemail.com wrote:


 I think this will just work fine:

 android.os.Process.killProcess(android.os.Process.myPid());

 As far as I know, it kills the current DalvikVM right on the spot, so
 be careful.

 On 10 Aug., 20:49, jhoffman keshis...@gmail.com wrote:
  It really depends on the structure of your app, but one trick you
  might employ is to launch your various activities with
  startActivityForResult(intent, ID);
  and then override onActivityResult to watch for a return value from
  the activity you launched. You can then make decisions about whether
  you should call finish() in the original activity, or whether the user
  just wanted to go back to that original activity without closing the
  entire app.
 
  Again, without knowing the structure of your app or more details, I
  can't be sure that this is actually going to be helpful to you. If it
  isn't though, feel free to post some specifics! :)
 
  On Aug 10, 2:36 am, Blackmarket pascal.se...@gmail.com wrote:
 
   Hi,
 
   i want to add anexitbutton to the menu, but didn't see an easy way
   to close anapplicationor acces all activities of anapplicationand
   finish them. Is there an easy approach avaible?
 
   Regards, Pascal
 
 
 



-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Close Application

2009-08-10 Thread Carl Whalley

System.exit(0)

--
Android Academy http://www.androidacademy.com

On Aug 10, 10:36 am, Blackmarket pascal.se...@gmail.com wrote:
 Hi,

 i want to add an exit button to the menu, but didn't see an easy way
 to close an application or acces all activities of an application and
 finish them. Is there an easy approach avaible?

 Regards, Pascal
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Close Application

2009-08-10 Thread Blackmarket

Doesn't work. It just closes the active Activity and changes to the
last Activity. Actually it has the same effect like finish()

Regards, Pascal

On 10 Aug., 11:54, Carl Whalley carl.whal...@googlemail.com wrote:
 System.exit(0)

 --
 Android Academyhttp://www.androidacademy.com

 On Aug 10, 10:36 am, Blackmarket pascal.se...@gmail.com wrote:

  Hi,

  i want to add an exit button to the menu, but didn't see an easy way
  to close an application or acces all activities of an application and
  finish them. Is there an easy approach avaible?

  Regards, Pascal


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Close Application

2009-08-10 Thread Alessio Grumiro
Android kills your application if it is unused for long time.Your job is to
close all application's activities with finish() method.

Bye

2009/8/10 Blackmarket pascal.se...@gmail.com


 Hi,

 i want to add an exit button to the menu, but didn't see an easy way
 to close an application or acces all activities of an application and
 finish them. Is there an easy approach avaible?

 Regards, Pascal
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Close Application

2009-08-10 Thread Alessio Grumiro
you have to close all application's activities! When you change activity,
you have to call finish() on old activity, so just one activity is shown on
screen and in stack.

2009/8/10 Blackmarket pascal.se...@gmail.com


 Doesn't work. It just closes the active Activity and changes to the
 last Activity. Actually it has the same effect like finish()

 Regards, Pascal

 On 10 Aug., 11:54, Carl Whalley carl.whal...@googlemail.com wrote:
  System.exit(0)
 
  --
  Android Academyhttp://www.androidacademy.com
 
  On Aug 10, 10:36 am, Blackmarket pascal.se...@gmail.com wrote:
 
   Hi,
 
   i want to add an exit button to the menu, but didn't see an easy way
   to close an application or acces all activities of an application and
   finish them. Is there an easy approach avaible?
 
   Regards, Pascal
 
 
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Close Application

2009-08-10 Thread Blackmarket

Is there a way to access all Activities of an Application? My Problem
is, that i don't know how to access other activities to close them.

On 10 Aug., 12:49, Alessio Grumiro a.grum...@gmail.com wrote:
 you have to close all application's activities! When you change activity,
 you have to call finish() on old activity, so just one activity is shown on
 screen and in stack.

 2009/8/10 Blackmarket pascal.se...@gmail.com



  Doesn't work. It just closes the active Activity and changes to the
  last Activity. Actually it has the same effect like finish()

  Regards, Pascal

  On 10 Aug., 11:54, Carl Whalley carl.whal...@googlemail.com wrote:
   System.exit(0)

   --
   Android Academyhttp://www.androidacademy.com

   On Aug 10, 10:36 am, Blackmarket pascal.se...@gmail.com wrote:

Hi,

i want to add an exit button to the menu, but didn't see an easy way
to close an application or acces all activities of an application and
finish them. Is there an easy approach avaible?

Regards, Pascal


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Close Application

2009-08-10 Thread Alessio Grumiro
I don't know, but you can save each activitie in a static list.

2009/8/10 Blackmarket pascal.se...@gmail.com


 Is there a way to access all Activities of an Application? My Problem
 is, that i don't know how to access other activities to close them.

 On 10 Aug., 12:49, Alessio Grumiro a.grum...@gmail.com wrote:
  you have to close all application's activities! When you change activity,
  you have to call finish() on old activity, so just one activity is shown
 on
  screen and in stack.
 
  2009/8/10 Blackmarket pascal.se...@gmail.com
 
 
 
   Doesn't work. It just closes the active Activity and changes to the
   last Activity. Actually it has the same effect like finish()
 
   Regards, Pascal
 
   On 10 Aug., 11:54, Carl Whalley carl.whal...@googlemail.com wrote:
System.exit(0)
 
--
Android Academyhttp://www.androidacademy.com
 
On Aug 10, 10:36 am, Blackmarket pascal.se...@gmail.com wrote:
 
 Hi,
 
 i want to add an exit button to the menu, but didn't see an easy
 way
 to close an application or acces all activities of an application
 and
 finish them. Is there an easy approach avaible?
 
 Regards, Pascal
 
 
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Close Application

2009-08-10 Thread Marco Nelissen

System.exit() is definitely not the same as Activity.finish()


On Mon, Aug 10, 2009 at 3:45 AM, Blackmarketpascal.se...@gmail.com wrote:

 Doesn't work. It just closes the active Activity and changes to the
 last Activity. Actually it has the same effect like finish()

 Regards, Pascal

 On 10 Aug., 11:54, Carl Whalley carl.whal...@googlemail.com wrote:
 System.exit(0)

 --
 Android Academyhttp://www.androidacademy.com

 On Aug 10, 10:36 am, Blackmarket pascal.se...@gmail.com wrote:

  Hi,

  i want to add an exit button to the menu, but didn't see an easy way
  to close an application or acces all activities of an application and
  finish them. Is there an easy approach avaible?

  Regards, Pascal


 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Close Application

2009-08-10 Thread jhoffman

It really depends on the structure of your app, but one trick you
might employ is to launch your various activities with
startActivityForResult(intent, ID);
and then override onActivityResult to watch for a return value from
the activity you launched. You can then make decisions about whether
you should call finish() in the original activity, or whether the user
just wanted to go back to that original activity without closing the
entire app.

Again, without knowing the structure of your app or more details, I
can't be sure that this is actually going to be helpful to you. If it
isn't though, feel free to post some specifics! :)

On Aug 10, 2:36 am, Blackmarket pascal.se...@gmail.com wrote:
 Hi,

 i want to add an exit button to the menu, but didn't see an easy way
 to close an application or acces all activities of an application and
 finish them. Is there an easy approach avaible?

 Regards, Pascal
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---