2

I know it may not be best practice but this is what i want to do.

When my broadcast receiver is called - start a new activity which has is not fullscreen and has a transparent background - which opens on top of your current activity / desktop wallpaper.

The code I have so far is as follows:

I create + call a new activity with :


  Intent testActivityIntent = new Intent(context, com.andy.tabletsms.work.SMSPopup.class);
                testActivityIntent.putExtra("com.andy.tabletsms.message", main.msgs.get(i));
                testActivityIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                testActivityIntent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
                context.startActivity(testActivityIntent);

And then the activity has a theme of :

android:theme="@android:style/Theme.Translucent.NoTitleBar"

And the code of the activity is just a bog standard activity with a simple layout. However when that broadcast receiver starts the activity - it appears on top of the previous activity which was started when the applicaiton started.....as per this image shows : alt text

Rich Schuler
  • 41,814
  • 6
  • 72
  • 59
RenegadeAndy
  • 5,440
  • 18
  • 70
  • 130

3 Answers3

5

This is related to the problem I answered in a previous question here: Activity started from notification opened on top of the activity stack

Basically it's all about: android:taskAffinity and android:launchMode

Community
  • 1
  • 1
Rich Schuler
  • 41,814
  • 6
  • 72
  • 59
0

Dont use android:theme="@android:style/Theme.Translucent.NoTitleBar" leave the android:theme as the default.This works for me

Sanda
  • 21
  • 2
0

You've asked this same question like 3 times now and we still don't have nearly enough information. You keep mentioning the "original activity" but we have no idea what that is, how you started it, or where it went such that it "comes back".

Your probably is you're probably not finishing your "main" activity, or that you have weird flags, or it's listening for the same intent.

You also don't show us anything about your broadcast receiver.

Falmarri
  • 47,727
  • 41
  • 151
  • 191
  • 1
    I mention the problem might be weird flags. I meant the launch flags in the manifest. I wasn't too clear, but neither was the question and that's the only answer he can possibly expect. – Falmarri Jan 07 '11 at 20:16
  • Well Qberticus seems to have suggested something which would make perfect sense and may well solve the problem. The original actvivity is the one which was created when I made the android project - it doesnt do much at the moment, but will be used for settings etc. It has no receciver or anything. I wouldve posted more if there was more to say.... – RenegadeAndy Jan 07 '11 at 21:06