Android - When launch the same activity from widget with different extras, how to prevent the same instance show up after returned from HOME button?

前端 未结 5 1833
我在风中等你
我在风中等你 2021-01-13 12:52

I have a widget that contains 4 buttons to show 4 stock prices, each of them will launch into the same activity Quote.class to show stock details. In onUpdate(), it will set

5条回答
  •  旧巷少年郎
    2021-01-13 13:39

    clickIntent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
    

    Since: API Level 1 If set, the new activity is not kept in the history stack. As soon as the user navigates away from it, the activity is finished. This may also be set with the noHistory attribute.

    This solved the same issue of mine while implementing widget activities.

提交回复
热议问题