goodm
goodm

Reputation: 7295

Prevent to reopen the application Android Developer

Its simple question and hope to find quick answer. When I open the application and press "home", after that click on the app icon it's open again (still keep open already one in background). How to force to reopen the app from background instead of open a new one?

This problem dont occur when I'm using longpress "home" button.

Upvotes: 1

Views: 839

Answers (2)

Jack
Jack

Reputation: 2625

If you only want this for testing purposes you can use the force close button in settings. If its a feature of your app try

onPause(){
super.onPause();
finish();
}

I haven't tested this so i could be wrong.

Upvotes: 1

aleksikallio
aleksikallio

Reputation: 1932

Try modifying the android:launchMode variable in your activity tag in androidManifest.xml. Depending on your app, SingleTop or SingleTask could work like what you want. See the developer documentation for details.

Upvotes: 2

Related Questions