Friday, 10 August 2012

Close android app and launch safety (Android)

The entire lifetime of an activity happens between the first call to onCreate(Bundle)
through to a single final call to onDestroy().
To save exit from the application we need to implement method OnDestroy();


/*****************************************/
    protected void onDestroy(){

        // call constructor
        super.onDestroy();

        //If this is set to true then the process
        //will not be killed until all of its threads have closed.
        System.runFinalizersOnExit(true);

        //Force system to close the application
        System.exit(0);
    }
/*****************************************/

No comments:

Post a Comment