0

I have an app with one activity that I can't seem to stop. I have a button on it that executes finish(). Whether I use that or I use the back button on the phone the app continues to run.

I see it's still running by tapping on it in Applications and the Force Stop button is enabled.

What might be causing this? Thanks, Gary

Dean Blakely
  • 3,535
  • 11
  • 51
  • 83
  • This has already been covered before see http://stackoverflow.com/questions/3241322/android-howto-kill-my-own-activity-the-hard-way – DevWithZachary Jan 20 '13 at 22:43

2 Answers2

0

Try this code to stop your activity/app instead of finish(),

android.os.Process.killProcess(android.os.Process.myPid());
abhi
  • 503
  • 6
  • 24
0

Suicide (Option 1)

  1. Call finish(); on button click
  2. Add this line to onDestroy method:

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

    public void onDestroy() {
        super.onDestroy();
        android.os.Process.killProcess(android.os.Process.myPid());
    }       

Suicide (Option 2)

Call this in the button listener

System.exit (0);
Dheeraj Bhaskar
  • 18,633
  • 9
  • 63
  • 66