Reputation: 51
I am working on my own home launcher replacement and it works fine but one thing bothers me. When I press a home key, current home activity (the one defined in manifest as main/defualt/launcher/home) restarts - current activity instance onpause is executed and oncreate is fired again, so new activity is brought up.
On the other hand, ADW launcher and LauncherPRo does not behave like that - I do not a refresh like in my case. Launcher Pro even can do several actions:
Any ideas how to do that?
I just did a very simple prototype from scratch with just one activity (defined in manifest as main/defualt/launcher/home) and I see the same thing - it gets recreated if I press Home.
Upvotes: 5
Views: 5095
Reputation: 93
Add
if (!isTaskRoot()) {
finish();
return;
}
to the onCreate() of your first Activity (see Android application restarts when opened by clicking the application icon).
Upvotes: 6
Reputation: 1006539
Add android:launchMode="singleInstance"
to your <activity>
element in the manifest.
Upvotes: 5