siamii
siamii

Reputation: 24134

Overlay activity over other activity opened via intent

I'm trying to overlay a small caption box over a photo whenever it is viewed in the gallery.

I couldn't find any intents for VIEWING A PHOTO that is broadcast by the gallery app, into which I could hook a broadcast receiver to draw the box.

So I'm using Intent.GET_CONTENT to get a photo from gallery and Intent.VIEW to display it. Is it possible to overlay a semi transparent caption box over the gallery app's activity that I opened via Intent.VIEW?

Upvotes: 0

Views: 1424

Answers (1)

CommonsWare
CommonsWare

Reputation: 1007659

I'm trying to overlay a small caption box over a photo whenever it is viewed in the gallery.

This is not possible. For starters, there is no "gallery" application in the Android OS. There typically will be an application to let you get a photo via GET_CONTENT and view an image via VIEW, but whether or not they bear any resemblance to what you think of as a "gallery" is indeterminate.

I couldn't find any intents for VIEWING A PHOTO that is broadcast by the gallery app, into which I could hook a broadcast receiver to draw the box.

Again, this will vary by app, but I really rather doubt any supply such broadcasts.

Is it possible to overlay a semi transparent caption box over the gallery app's activity that I opened via Intent.VIEW?

Not reliably, because you have no way of knowing when the VIEW activity is on-screen and whether the user has tapped something (e.g., HOME) when in that other activity. You will be better served viewing the image yourself in your own activity, where you can also display your "semi transparent caption box".

Upvotes: 1

Related Questions