How to make an overlay when sharing into app in android?

1.2k views Asked by At

I am working on an android app that receives content from another apps sharing it via an android intent. I did the intent filter to receive the shared content into the app, but I saw that apps like Pocket made that without leaving the original app with an overlay over the app and I don't know how to do that. Does anyone know how to do that or give me some hints?

enter image description here

3

There are 3 answers

2
Nikola Despotoski On BEST ANSWER

Start activity that has transparent theme with following attributes (test this on API 18 for bug):

<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsFloating">true</item>
<item name="android:backgroundDimEnabled">false</item>

Set child elements as you desire, as you would do in normal activity.

0
BlackHatSamurai On

I would look at the WindowManager Class:

http://developer.android.com/reference/android/view/WindowManager.html

Here is a link to a question that better explains what it is:

What is WindowManager in android?

0
bonnyz On

After receiving your Intent, you should start a Service which create and attach your View/ViewGroup on the Window. This will allow you to keep the calling application in foreground.

To create a floating overlay take a look here: http://www.piwai.info/chatheads-basics/