add listener to listview in dialog

by zcj0429 » Tue, 06 Jan 2009 11:44:51 GMT

Sponsored Links
   I'm now create a listview in a dialog. But I don't know how to
detected if an item is clicked. Then background activity is
"PreferenceActivity", and the "onListItemClick" method seems not work.
Here is the relevant code:
public void changeConnPref() {
                conns = new ArrayList<String>();
                mDialog = new Dialog(this);
                mDialog.setTitle("Connection Preference");
                bConnAdapter = new ConnAdapter(conns, mDialog.getContext());
                ListView dlv = (ListView) mDialog.findViewById(;

                Button bOk = (Button) mDialog.findViewById(;
                bOk.setOnClickListener(new OnClickListener() {
                        public void onClick(final View v) {


                Button bCancel = (Button) mDialog.findViewById(;
                bCancel.setOnClickListener(new OnClickListener() {
                        public void onClick(View v) {

Can anyone help?

Other Threads

1. zipalign and Proguard

As you mightknow new to SDK 1.6 is the zipalign to align data
resources for better and optimized performance and it gets used after
apk is signed.

My question is how does this affect those who may be obfuscating their
classes by using Proguard?

Will I stil be able to obfuscate the classes using Proguard?



2. set transparent background of an imageview in android


i am using a web view in which i am adding a image i want to
set the background of this image view transparent.i hv tried setting

mImageview.setBackgroundResource(R.color.trans); [where trans => <
color name="trans">#00000000 < / color >]

plz help.... thanks in advance...


3. building android from source code & running in emulator and measuring video playback performance using opencore

4. mp4 composer api

5. How to dismiss Spinner's Dialog automatically

6. PV logging

7. problem occurred installing ADT plugin