add listener to listview in dialog

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


Sponsored Links
 Hi:
   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>();
                conns.add("WIFI");
                conns.add("Bluetooth");
                mDialog = new Dialog(this);
                mDialog.setContentView(R.layout.connpreference);
                mDialog.setTitle("Connection Preference");
                bConnAdapter = new ConnAdapter(conns, mDialog.getContext());
                ListView dlv = (ListView) mDialog.findViewById(R.id.conn_list);
                dlv.setAdapter(bConnAdapter);

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

                                mDialog.dismiss();
                        }
                });

                Button bCancel = (Button) mDialog.findViewById(R.id.pre_cancel);
                bCancel.setOnClickListener(new OnClickListener() {
                        public void onClick(View v) {
                                mDialog.cancel();
                        }
                });
}
--------------------------------------------------------------------------------------------------------------

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?

Thanks


--~--~---------~--~----~------------~-------~--~----~

2. set transparent background of an imageview in android

hello...

i am using a web view in which i am adding a image view..now 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