3

I want to display an activity as a popup window at the bottom of my screen how can I implement that??

I made that activity to open as a popup window after some delay,for this I have used handler and set the android theme in manifest to Dialog and it is working too. But it is displaying it in the center of the screen but I want it to be displayed at the bottom of my scree.

Can anybody help me in this regard?

And the below is my code:

Handler handler=new Handler();
handler.postDelayed(new Runnable(){public void run(){Intent intent=new Intent(getApplicationContext(),Schedule_Popup_Activity.class); startActivity(intent);}}, delay);

And the changes I made in manifest xml file is:

<android name="Schedule_Popup_Activity
android:theme="@android:style/Theme.Dialog">

How to set this activity to the bottom of my screen with its height and width similar to an popup window size??

Thanks in advance...

PlacementMode=Bottom is to set the popup window at the bottom,is there anything similar for the activity also?

user3350830
  • 89
  • 1
  • 14
  • what you want to show in the back ground when the pop up is coming ? – Sree Apr 09 '14 at 05:51
  • Actually I will be displaying some data in my 1st activity and after a few seconds of delay I will be popping up the activity with 3 image buttons and I perform actions on it,meanwhile I want to display both the activities.. – user3350830 Apr 09 '14 at 05:55
  • Its just like a screen in anydo app. Displaying some data in one activity and providing a popup activity whether to actions to accept or reject or reschedule(as requirement in my project) – user3350830 Apr 09 '14 at 05:57
  • 1
    create a layout which look like a popup and as activity , this is the one way. I have used a normal activity with dialog theme and set it's background to transparent, and override onAttachActivity event to set the position and width and height of my new activity as I want. – Sree Apr 09 '14 at 05:59
  • why don't you use fragments? – Syed Waqas Apr 09 '14 at 06:00
  • 1
    Why don't you make a customized pop-up and give your activity's layout to that pop-up and set gravity of the pop-up to bottom – codeRider Apr 09 '14 at 06:00
  • yeah I have tried the same,but I got an error at @location.. So i planned to use the activity instead of customized popup window. – user3350830 Apr 09 '14 at 06:08
  • http://stackoverflow.com/questions/19146392/popup-window-like-any-do in this example they too have used the popupActivity ..My requirement is similar to this – user3350830 Apr 09 '14 at 06:11

2 Answers2

2

To my above code i just made some changes to get this done. I wrote a style as shown below :

<style name="MyFloatingWindow">
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:background">@android:color/transparent</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowNoTitle">true</item>

<item name="android:gravity">bottom</item>

And used this in manifest as :

android:theme="@style/MyFloatingWindow">

user3350830
  • 89
  • 1
  • 14
0

You can consider using windowmanager and add view to the windowmanager by addView()

xXJJJasonMokXx
  • 367
  • 4
  • 17