Wednesday, June 9, 2010

[android-developers] Re: Focus problem in GridView inside Dialog

Just for the record, I resolved the problem. The problem was in
ListAdapter, or rather, the way it interacted with the rest of the
program. As a result, call to getItem() triggered unnecessary list
change notification, which caused this weird behavior.

Cheers,
Piotr

On 7 Cze, 19:44, Piotr Buła <piotr.b...@gmail.com> wrote:
> H there,
>
> I have a little problem with selecting items that are insideGridView
> that is displayed inside adialog.
>
> What I want to achieve is adialogwindow that shows a grid of images
> that user can select (click on them) and some action is executed. I
> figured I'd just create aGridViewbacked by ListAdapter and set that
> on theDialog. But that causes some problems. Once you scroll the list
> of images, they become unselectable. Using trackball brings the
> selection back to the items and they become clickable again, until you
> scroll the list. This really gives me a headache.
>
> Below is the code I use to create mydialog:
>
> GridViewmyView = newGridView(MyActivity.this);
> myView.setNumColumns(2);
> myView.setAdapter(myImages.getListAdapter());
> myView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
>     @Override
>     public void onItemClick(AdapterView<?> parent, View view,
>             int position, long id) {
>         Log.i(TAG, "onItemClick: ");
>     }
>
> });
>
> DialogmyDialog = newDialog(MyActivity.this);
> myDialog.setTitle("My Cool Images");
> myDialog.setContentView(myView);
>
> return myDialog;
>
> Am I missing something here? The sample code from ApiDemos is not much
> different, except that it does not involve Dialogs, so I'm thinking it
> might be something related toDialogstuff.
>
> Cheers,
> Piotr

--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment