Jul 4, 2011

How to force stop my android application programatically ?

This finishs my application. But if I go to
'Settings -> Applications -> Manage applications -> , I can see the 'Force Stop' button is enabled
(This means my application was not stopped completely ?). How can I finish my android application completely and makes 'Force Stop' button disabled in the 'Settings' ? From my limited experience, only when an 'Exception' (ex. Nullpointerexception) occurs in the application and it stops abnormally, my application looks like finished completely and the 'Force Stop' button looks disabled.

I'd like to force stop my android applicataon when I click closeButton. This is my code.

protected void onCreate(Bundle savedInstanceState) {


this.closeButton = (Button)this.findViewById(R.id.close);

this.closeButton.setOnClickListener(new OnClickListener() {


public void onClick(View v) {

finish(); // for stopping Current Activity



// add this line for Removing Force Close
protected void onDestroy() {
// closing Entire Application

No comments:

Post a Comment