I want to close my application, so that it no longer runs in the background.
How to do that? Is this good practice on Android platform?
If I rely on the \"ba
This is the way I did it:
I just put
Intent intent = new Intent(Main.this, SOMECLASSNAME.class);
Main.this.startActivityForResult(intent, 0);
inside of the method that opens an activity, then inside of the method of SOMECLASSNAME that is designed to close the app I put:
setResult(0);
finish();
And I put the following in my Main class:
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if(resultCode == 0) {
finish();
}
}