Exiting an Application Activity


I didn't check this, because normally in android you not exit from the app, android os take the garbage collection for the app.

So here is the code for existing from an activity.


exitButton = (Button)findViewById(R.id.exit_button);
    exitButton.setOnClickListener(
         new Button.OnClickListener() {
              public void onClick (View v){
                   Log.d(TAG, v.toString() + ": Leaving activity...");
                   Runtime.getRuntime().exit(0);
               }
         }
);

Comments

Popular posts from this blog

There was a problem saving your changes. Please try again later.

Offers on Wednesday, March 11, 2020

Offers on Friday, April 24, 2020