Passing bundle to activity set as singletask

前端 未结 1 1671
我寻月下人不归
我寻月下人不归 2021-01-03 10:06

So I have a MapActivity that runs an asynchtask that occasionally updates what exactly it\'s displaying on the map (via a string). I originally pass this string in from the

相关标签:
1条回答
  • 2021-01-03 10:45

    When your activity flagged as singleTask is already running and a new Intent is sent to it, onNewIntent will be called to tell you about it.

    By default, this new Intent does not get stored in any way after that call returns, and the default implementation does nothing. If you override onNewIntent, you can process the extras attached to the new intent directly from there and/or use setIntent to attach the new intent to your Activity so that future getIntent().get*Extra(...) calls will return the updated data.

    Note that there is one special case: if your singleTask activity has launched another activity in its task (i.e. an embeddable activity without the NEW_TASK flag), that activity will come to the foreground when your activity receives an intent, but the intent itself will then be silently dropped. Be careful about that. See the Dev Guide for more info.

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