Wednesday, August 24, 2011

[android-developers] Re: How to exit application

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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment