Passing a package to an action defined as syntactic

So, I have a MapActivity that launches asynchtask, which sometimes updates what exactly it displays on the map (via a line). I initially pass this line out of intent when the action is first created. And then, if you click on one of the drawings on the map, it will open a new action, which can then create a new mapview (the same class) with a different line. The problem is that I want one instance of mapview to be started right away. So I set android: launchmode = "singletask" in the manifest. This works in the sense that it brings the map to the front, but is there a way to send a new intent package to get a new parameter for the desired line? I tried reinstalling additional components from the package, but it looks like it saved the old package, not the new intent that was passed to it.I'm not sure what I want to do startActivityForResult, because the 2nd activity may or may not want to update the original activity.

Hope that made sense. I can send the code if necessary, but I think this should explain my situation.

+3
source share
1 answer

When your action marked as singleTaskis already running and a new one is sent to it Intent, it will be called onNewIntentto tell you about it.

Intent , , . onNewIntent, , , / setIntent , getIntent().get*Extra(...) .

, : singleTask - (.. NEW_TASK), , , . . . .

+9

Source: https://habr.com/ru/post/1742233/


All Articles