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. Running Monkeyrunner directly on Android tablet


I wanted to run a python script directly on an Android device through
I have installed the following applications on my Android device:
SLA4, Python for Android.

But when I try to run the script through Python interpretter, I get
the error saying "Import Error: No Module named"

Are Monkeyrunner and Monkey tools not included along with the Android
OS ?

Could some one suggest, how to start creating scripts using
Monkeyrunner API ?

Appreciate any help.



2. Group

Is this group active?


3. UPDATE 2 --- WTI: Info Lengkap Penjualan LG Android Rp 999 Ribu

4. [id-bb-sby] UPDATE 2 --- WTI: Info Lengkap Penjualan LG Android Rp 999 Ribu

5. Regarding accessing resources of other applications

6. UPDATE 2 --- WTI: Info Lengkap Penjualan LG Android Rp 999 Ribu

7. set the data connection ON by code?