3

I have tried and tried to get a transparent, floating Activity to show up (as an overlay), but allow whatever is behind it to still show AND update. Right now it seems that if the Activity behind mine is closed or a new one opens (could be either in this case), the new underneath Activity does not shine through my Activity to the user.

I have tried every combination of Flags I can come up with, and at this point I'm assuming Flags are not the answer. Can anyone help me find the proper code to do such a thing?

Before anyone asks, I have a valid use case for this type of Activity; no, I don't plan to annoy the user with it.

Jesta
  • 1,387
  • 2
  • 9
  • 9

3 Answers3

2

As far as I know, this is not possible. It should be possible to create an activity using the theme Theme.Dialog or Theme.Translucent (see http://developer.android.com/guide/topics/ui/themes.html) to have whatever activity is beneath it still show at least partially. The problem is, is that the Activity below will be Paused (it's onPause will have fired, but it's onStop will not have) and I don't believe it is possible in any way to have it run any code.

Maximus
  • 8,351
  • 3
  • 29
  • 37
1

I have not investigated in making a transparent Activity but I don't think it's possible in an Activity way. This seems to be logical since even if you have a transparent Activity it's still relying on the View inside it - the View makes the transparent part, not the Activity. This means you're probably gonna end up with a transparent View instead.

If you have a "front" Activity with a transparent View and then a "back" Activity, the "back" Activity would not be visible to the user - and that's because you're in another Activity.

So, the correct way is to use a transparent View.

Wroclai
  • 26,835
  • 7
  • 76
  • 67
0

It is possible to update the activity below by implementing a Broadcast receiver on it, and sending Broadcasts from whenever you want.

neteinstein
  • 17,529
  • 11
  • 93
  • 123
  • Unfortunately, I can only do this if I own the below activity. I need to show over any activity, including those of any other app. Your point is valid within the same app though :) – Jesta May 11 '12 at 04:14