0

I have a starting\home activity that is first launched.

In another flow I wrote a broadcast receiver that is triggered by the dialer.

The later shows an transparent activity with popup-fragment on it.

    @Override
    protected void handleReceive(Context context, Intent intent) {
..
                Intent i = new Intent(context, PopupActivity.class);
                i.putExtra(Constants.DIALED_PHONE, phoneDal.getItem(phoneNumber));
                i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                context.startActivity(i);
                setResultData(null);

and yet the popup appear with the transparent hosting activity

but also the "home\main\launch" activity that was opened before hand.

Also when I hide the popup (pressing "home" button)

I see all my app activities are gathered to on task, and not two as I expected. why is that?

wasn't i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); supposed to solve this?

Elad Benda2
  • 13,852
  • 29
  • 82
  • 157
  • Read my answer here: http://stackoverflow.com/a/27795433/3922207. It's a new idea and simple to use without using `FLAG`. – Anggrayudi H Jan 10 '15 at 12:28
  • @AlbertNicko why to avoid flag? what is missing in my solution? – Elad Benda2 Jan 10 '15 at 23:01
  • You must clear the backstack for your last activities. It may solve your problem (see concept map on my answer). If `PopupActivity.class` is a last activity, set `android:noHistory="true"` inside `` element in your manifest. I have faced this problem before when using `FLAG` and make my own research to solve this without `FLAG`. And evidently works for me. Until now, I still use my method. – Anggrayudi H Jan 11 '15 at 04:02

0 Answers0