How do you prevent an Android Wear activity from h

2020-06-06 01:11发布

问题:

Sometimes, most of the time when my LG G watch closes the app automatically by going to sleep/dim mode, if I open the app again by going to the start menu there are two instances of the activity opened (when I slide one off the previous one is underneath).

This never happens in a phone, is this how activities work in Android Wear? Should I "finish()" them in onPause()?

Thanks.

回答1:

Have you looked at the android:launchMode attribute in the AndroidManifest.xml for the activity?

perhaps android:launchMode="singleInstance" will help you out.

http://developer.android.com/guide/topics/manifest/activity-element.html#lmode