On Fri, Jul 8, 2011 at 5:34 AM, nageswara rao rajana
<nagu.raj...@gmail.com> wrote:
>      I have 3 activites in my application. Exit in menu options.
>        This is the code i am using for my exit
>
>    Code for menu options:
>              public boolean onCreateOptionsMenu(Menu menu) {
> MenuInflater inflater = getMenuInflater();
> inflater.inflate(R.menu.main, menu);
> return true;
> }
> @Override
> public boolean onOptionsItemSelected(MenuItem item)
> {
> switch(item.getItemId())
> {
> case R.id.help:
> Intent s=new Intent(MainActivity.this,HelpActivity.class);
> startActivity(s);
> break;
> case R.id.exit:
>     super.onDestroy();
>     this.finish();
>     break;
> case R.id.about:
> Intent t=new Intent(MainActivity.this,AboutUsActivity.class);
> startActivity(t);
> break;
> }
> return true;
> }
> My problem when i click on exit my application is closing but it is still
> running in background.
> Again i need to go to Settings->Applications->Manage
> Applications->Running->my application name. Here i need to ForceClose the
> application.
>
> So, please help me to avoid this process and exit application. Any sample
> code please.

Get rid of your Exit menu:

http://blog.radioactiveyak.com/2010/05/when-to-include-exit-button-in-android.html

http://stackoverflow.com/questions/2033914/quitting-an-application-is-that-frowned-upon/2034238#2034238

Android will destroy your activities as part of normal cleanup, when
the OS needs RAM. You do not have to do anything special for this.

Also, do not call super.onDestroy() from any place other than inside
of onDestroy().

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training...At Your Office: http://commonsware.com/training

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

Reply via email to