Showing dialog on top of another running activity (Android)?

Go To StackoverFlow.com

1

I've created an application that works with another app on the Android platform. The other application passes my app information, with intents, based on user action. I was hoping, that I might be able to pop a translucent information dialog, on top of the other application. I followed one of the examples, here, but it brought my application back to the foreground and put the dialog on top of that. Is this possible? I'm hoping to avoid having to work with the other developers to set up intent listeners, and whatnot, to show my information.

2012-04-05 15:59
by user1315718


1

If you want to handle a popup on top of another activity, you must use broadcast listener for implementation. As far as translucent property is concerned, you can add the below line while instantiating a new dialog: dialog = new DialogBox(this, R.style.Transparent);

For implementing this, You need to write the following piece of code in styles.xml which will reside in values folder of the project.

      <style name="Transparent">
        <item name="android:windowIsTranslucent">true</item>
        <item name="android:windowAnimationStyle">
         @android:style/Animation.Translucent</item>
        <item name="android:windowBackground">@drawable/transparent</item>
        <item name="android:windowNoTitle">true</item>
        <item name="android:colorForeground">#fff</item>
      </style>

Similarly, You need to add the below line in colors.xml file present in values folder:

     <drawable name="transparent">#00000000</drawable>

Also, you can try this out: To Add Blur to the background image

     WindowManager.LayoutParams lp = dialog.getWindow().getAttributes();  
     lp.dimAmount=0.0f;  
     dialog.getWindow().setAttributes(lp);  
     dialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND);  

Hope this will help.

Thanks!

2013-07-23 13:21
by RightRe
Ads