Cart (where I click \"Save cart\")" />
开发者

How to wake up an Activity in Android?

I have an application in which I click:

Menu -> Catalogue -> Product Group -> Product Detail (where I click "Add to cart" and open the Cart) -> Cart (where I click "Save cart")

Cart Activity is then finish()-ed and Product Group is shown. But I want Menu Activity to be shown.

Should I just use Intent intent = new Intent(this, Menu.class); startActivity(intent);

to open the menu, or is there a possibility to wake Menu Activity up.

Hope it's clear :)

EDIT 2010/12/15

This is call from Cart Activity

Intent intent = new Intent(this, Menu.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);

and it closes the application :(

SOLVED 2010/12/17:

Intent intent = new Intent(this, Menu.class);
//          intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
            intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
            startActivity(intent);

Don't forget to add android:launchMode="singleTop" into the manif开发者_运维知识库est.xml


Sounds like you want an Intent aimed at your Menu activity with the FLAG_ACTIVITY_CLEAR_TOP flag set.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜