I did notice that if I remove

popupview.setAdapter(new ImageAdapter(this));

I no longer throw the exception.  Am I using the Adapter wrong?  Any
help would really be appreciated.

On Nov 10, 7:29 pm, k_day <kevin.r....@gmail.com> wrote:
> I tried to post on
>
> http://groups.google.com/group/android-developers/browse_thread/threa...
>
> but it appears the discussion is locked (no reply button) for some
> reason.
>
> I am having a similar issue while trying to use a GridView in a
> PopupWindow.  On my Activity's onCreate method, I am inflating a
> gridview from xml as follows:
>
> LayoutInflater inflater = (LayoutInflater)this.getSystemService
> (Context.LAYOUT_INFLATER_SERVICE);
> final GridView popupview = (GridView) inflater.inflate
> (R.layout.gridviewpopup, null, false);
> popupview.setAdapter(new ImageAdapter(this));
>
> I would like this GridView to popup on a button click. Also inside of
> my activity's onCreate, I have:
>
> final Button addButton = (Button) findViewById(R.id.add);
>  addButton.setOnClickListener(new View.OnClickListener() {
>             public void onClick(View v) {
>                 PopupWindow mwindow = new PopupWindow(popupview, 100,
> 100);
>                 mwindow.showAtLocation(findViewById(R.id.main),
> Gravity.CENTER, 100, 100);
>                 mwindow.setFocusable(true);
>             }
>  });
>
> On button click, I am throwing a ClassCastException from
> GridView.onMeasure(int, int).
>
> Can anyone please explain to me what I am doing wrong?
>
> Thanks.
>
> -k_day

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to