V
V
Vladislav Onishchenko2015-04-16 12:35:01
Android
Vladislav Onishchenko, 2015-04-16 12:35:01

How to show Activity independently from the main application?

There is an application with its own activity A, and there is also a notification that calls another activity B, which looks like a dialog. With what flags\launchMode should B be started in order not to affect A?
Required: if A is minimized, show B on top of the current screen, otherwise show on top of A.
I tried FLAG_ACTIVITY_CLEAR_TOP, but then when B starts, A expands, and when singleInstance, A collapses and opens B.
Video:
youtu.be/ShDxThdu22M
There is a small response window on the video = = activate B. 3 actions:
1) launch from the application: everything is ok
2) launch after pressing "back": everything is ok
3) launch after pressing "home": deploys applications, not ok.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Max, 2015-04-20
@mbelskiy

We set launchMode for 'B' to singleTop and set flags for the intent:
intent.setFlags(FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_CLEAR_TOP);
In Activity B, don't forget to override onNewIntent();

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question