开发者

activities resume from homescreen launcher in emulator, but not on android device

My android application has a login screen that is launched as the main activity with intents as follows:

<intent-filter>
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

Nothing else is out of the ordinary (that I am a开发者_如何转开发ware of, concerning the other activities, etc, no additional intents set on those or anything).

With the emulator, if I login and the second activity is launched, then I press the home button, if I launch the app again from a homescreen shortcut the task returns to the second activity. This is the desired behavior, as I don't want the user to have to login over and over again.

With both an HTC Incredible and a Droid X (only phones I have access to), if I login and the second activity launches, then press the home button, if I relaunch the app from a homescreen shortcut, it always launches the login activity, which is not the desired result. I want it to resume at the second activity where I left off.

Does anyone have any insight as to why this works as intended with the emulator but not on the phones? Thank you very much.


I figured it out. I had completely uninstalled the app and deleted the shortcut from my home screen on the phone. Then it started working. My guess is it was the old shortcut on the home screen holding on to iffy intents or something (because im pretty sure I've uninstalled it a few times to no avail). Once everything was uninstalled/reinstalled and a new shortcut was created on the home screen it is working as intended. Hope this helps someone else.


I have the same behaviour on my HTC Desire. If I install the apk from my computer either by using eclipse or by command line via

adb install

everything is fine. If I install from the file on the phone, I get the behaviour you describe. I wonder what install/update via the market does but am afraid to give it like that to the users.

The difference to your case is that uninstall does not change a thing. Any ideas?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜