Tuesday, September 7, 2010

[android-developers] Re: ListView OnItemClickListener not working

Here is my code:

Dialog dialog = new Dialog(this);
dialog.setContentView(R.layout.save);
dialog.setTitle("Program Saving Center");
final ListView lvList = (ListView)
dialog.findViewById(R.id.lvList);

lvList.setOnItemClickListener(new OnItemClickListener(){
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
long arg3){
removeDialog(DIALOG_SAVE_ID);
}
});

lvList.setAdapter(new DBAdapter(this.getApplicationContext()));

I´m stuck on this...

On 7 set, 13:59, TreKing <treking...@gmail.com> wrote:
> On Tue, Sep 7, 2010 at 11:05 AM, Kostya Vasilyev <kmans...@gmail.com> wrote:
> >  Ah, it seems you are using a dialog. I wonder if this makes any difference
> > vs. an activity.
>
> Probably.
>
> OP, how are you setting up your dialog?
> If you're doing this method:http://developer.android.com/guide/topics/ui/dialogs.html#AddingAList
>
> You should be supplying a click listener as part of the setup, not after the
> fact.
> I wouldn't be surprised if the ListView in the dialog is "eating" the
> events.
>
> --------------------------------------------------------------------------- ----------------------
> TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago
> transit tracking app for Android-powered devices

--
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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate