PopupWindow doesn't show up

by jotobjects » Tue, 26 Apr 2011 03:36:25 GMT


Sponsored Links
 I have the following code but the PopupWindow does not appear.  I want
it to appear in the center of the screen. I'm not clear about what
"parent" in the last line is supposed to be... Does anybody see what
is wrong here?

PopupWindow popup = new PopupWindow(context);
TextView contentView = new TextView(context);
popup.setContentView(contentView);
contentView.setLayoutParams(
    new LayoutParams(LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT));
contentView.setText(text);
popup.showAtLocation(parent, Gravity.CENTER, 0, 0);

-- 



Re: PopupWindow doesn't show up

by TreKing » Tue, 26 Apr 2011 04:53:31 GMT


 



How is this compiling?

-------------------------------------------------------------------------------------------------
TreKing < http://sites.google.com/site/rezmobileapps/treking> ; - Chicago
transit tracking app for Android-powered devices

-- 


Sponsored Links


Re: PopupWindow doesn't show up

by jotobjects » Tue, 26 Apr 2011 07:27:19 GMT


 



context == activity.  text=="foobar and merry christmas".
I've tried a couple of different things for parent.  Here is the full
method -

public void onClick(View v)
{
        PopupWindow popup = new PopupWindow(context);
        TextView contentView = new TextView(context);
        popup.setContentView(contentView);
        contentView.setLayoutParams(
                new LayoutParams(LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT));
        contentView.setText(text);
        //View window = ((Activity)context).getWindow().getDecorView();
        popup.showAtLocation(v, Gravity.CENTER, 0, 0);
}

It does compile and tracing it with the debugger it executes without
error.

-- 



Re: Re: PopupWindow doesn't show up

by TreKing » Tue, 26 Apr 2011 07:58:42 GMT


 



OK, I thought you literally didn't know what you variable "parent" was,
which didn't make much sense :-P

Well, I've not used PopupWindow myself, so I don't know what to tell you.
FWIW, I tried an equally simple example (threw a textview with "Hello" in it
into a POW and tried to show it at the location of a ImageView I have in a
listview) and it did not work either.

Also tried showAsDropDown() and that didn't work either. I've seen the thing
used in plenty of other apps so I'm sure it works, but I guess it's not
as straightforward to use as it would appear.

-------------------------------------------------------------------------------------------------
TreKing < http://sites.google.com/site/rezmobileapps/treking> ; - Chicago
transit tracking app for Android-powered devices

-- 



Other Threads

1. How to know deletion of Media Store.

Hello Everyone,

I want to access from Media Store such as all audio, video and images......
I can access all information of Media Store and
I want to know this problems.
If some file is  deleted and updated , how do I know ?
All tables of primary key is not auto increment.
So far, I cannot know changes of these files.

Please , kindly reply me and post my mail.

Thanks

Ni

-- 

2. Question on building factory installed app with native Lib and external data on Cupcake

I am building an application that will be pre-installed on a cupcake
image. The application comes with a native library. My .apk file
contains the native library inside the /libs/armeabi directory and
the .apk has been tested fine when installed as a downloadable app.

I placed the .apk in the out/target/product/dream-open/system/app
folder, rebuild the image and load it on the Dream device.
Questions:

1) I found out the my native lib was not copied to the /data/data/<app-
path>/lib directory. This would normally happen if my app is installed
as a downloadable app. Why?

2) What is the way to include my native lib as part of the /system/lib
and installed on the device?

3) I also have a large set of data that needs to be read/write by the
app in runtime. Right now these files are copied out of the .apk when
the app is run the first time. Ideally the data files can be installed
in the /data/data/<app-path> directory as part of the system package.
Can this be done? I noticed that the com.android.alarmclock app has
its database files pre-installed, how is it done?

Thanks!

-- 
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: 

3. Worldwide requests from Android devices increased 5.8 times since April 2009

4. My program if fine in emulator but not on device, Inflate Exception

5. remove SMS notification

6. How to Create a file in Android Emulator Phone Memory

7. nHD(360x640) Vs. hVGA(320x480)