[android-developers] Re: How to exit application

2011-08-24 Thread Droid
System.exit(0) is not recommended because it messes up when a user
brings the app back after a short pause.
Horrible things can happen to what you've got in memory. Its not a
clean or consistent memory wipe IMO.

I think you have to work with the idea that activities are held in
memory for a time in the case of a return by the user to the app.

It is sometimes hard to deal with, but in my experience, I simply have
to go with it. I end up using onStop() and onStart() sometimes. And it
can get complicated.

Sorry if this is not the answer you wanted to hear as I expect you
want a complete close of the app and all its memory contents.
There might be a way of doing that but I don't know it and
System.exit(0 is too unpredictable to use AFAIK.



On Aug 24, 8:19 am, GopalaKrishnan D gopall...@gmail.com wrote:
 i tried finish(); and System.exit(0);

 if i use any one means only current activity closed its not close entire
 app

 Which code i want to use close or exit entire app.

 --
 ~* Regards*
 *GopalaKrishnan D*

-- 
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


Re: [android-developers] Re: How to exit application

2011-08-24 Thread Yahor Paulavets
Hello,

I had same issue, found a solution and post it in the blog:
http://softteco.blogspot.com/2011/07/how-to-close-activity-and-all-children.html

Do not forget to say thanks in comments if this info is useful! :)

Happy coding (:

Best regards,
Yahor

On Wed, Aug 24, 2011 at 11:01 AM, Droid rod...@gmail.com wrote:

 System.exit(0) is not recommended because it messes up when a user
 brings the app back after a short pause.
 Horrible things can happen to what you've got in memory. Its not a
 clean or consistent memory wipe IMO.

 I think you have to work with the idea that activities are held in
 memory for a time in the case of a return by the user to the app.

 It is sometimes hard to deal with, but in my experience, I simply have
 to go with it. I end up using onStop() and onStart() sometimes. And it
 can get complicated.

 Sorry if this is not the answer you wanted to hear as I expect you
 want a complete close of the app and all its memory contents.
 There might be a way of doing that but I don't know it and
 System.exit(0 is too unpredictable to use AFAIK.



 On Aug 24, 8:19 am, GopalaKrishnan D gopall...@gmail.com wrote:
  i tried finish(); and System.exit(0);
 
  if i use any one means only current activity closed its not close
 entire
  app
 
  Which code i want to use close or exit entire app.
 
  --
  ~* Regards*
  *GopalaKrishnan D*

 --
 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


-- 
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: How to exit application

2011-08-24 Thread James
Very simple. If you are sure you are done, You could just kill
yourself using
android.os.process.killProcess(android.os.Process.myPid()); It's the
same as linux shell command kill.

On Aug 24, 3:19 pm, GopalaKrishnan D gopall...@gmail.com wrote:
 i tried finish(); and System.exit(0);

 if i use any one means only current activity closed its not close entire
 app

 Which code i want to use close or exit entire app.

 --
 ~* Regards*
 *GopalaKrishnan D*

-- 
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: How to exit application

2011-08-24 Thread Droid
Its not always so simple to use
android.os.process.killProcess(android.os.Process.myPid()); to close
your app.
1) You cannot detect when the home button has been pressed so when to
call killProcess?  If you are lucky calling it in onStop() somehow may
work but that can get very difficult if you have many activities.
2) Some processes are not stopped by it. I could not use it when
service threads and other non-ui threads were spun up - didn't stop
them. Threads 'in progress' at the time can bring app back to life
after killProcess() called.








On Aug 24, 9:29 am, James 030440...@163.com wrote:
 Very simple. If you are sure you are done, You could just kill
 yourself using
 android.os.process.killProcess(android.os.Process.myPid()); It's the
 same as linux shell command kill.

 On Aug 24, 3:19 pm, GopalaKrishnan D gopall...@gmail.com wrote:







  i tried finish(); and System.exit(0);

  if i use any one means only current activity closed its not close entire
  app

  Which code i want to use close or exit entire app.

  --
  ~* Regards*
  *GopalaKrishnan D*

-- 
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: how to exit application

2011-06-03 Thread Edam
What method do you use to exit your app?

On Jun 3, 10:41 am, nageswara rao rajana nagu.raj...@gmail.com
wrote:
 Hi,

        I developed android application which consists  3 Activities, when i
 am in 3rd activity and clicked exit in menu options.
        The application closed, but again when i start application it opening
 the 3rd activity. So, please any help.

 With Regards,
 Nagu.

 nagu.raj...@gmail.com

-- 
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


Re: [android-developers] Re: how to exit application

2011-06-03 Thread nageswara rao rajana

 Hi,


This is the sample code i used in exit function.

 Intent e=new Intent(Intent.ACTION_MAIN);
e.addCategory(Intent.CATEGORY_HOME);
   e.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
   this.finish();
   startActivity(e);



with regards,
Nagu.

-- 
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