How do you skip parts of an Activity stack when returning results in Android?

后端 未结 2 1728
别跟我提以往
别跟我提以往 2021-01-29 03:47

I\'m making an app which has a flow roughly as below:

  1. User starts on the main screen with an empty list, hits menu, and goes to \"add item.\" (Activity A)
相关标签:
2条回答
  • 2021-01-29 04:16

    I recommend just invoking the activities (not using the *ForResult) calls, then having activity D invoke Activity A with an INTENT_ADD_ITEM with data, then have Activity A add the item.

    Hope this helps...

    0 讨论(0)
  • 2021-01-29 04:30

    Just so that people can benefit from what I learned later...

    The key to solving this problem is using flags with Intent, in this case using FLAG_ACTIVITY_CLEAR_TOP. Other flags are useful as well in controlling the flow of your UI.

    It is a bad idea to try to solve this problem by chaining startActivityForResult() through activities. It means that it's difficult to change the flow of your application.

    0 讨论(0)
提交回复
热议问题