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

Hi,

I wanted to run a python script directly on an Android device through
Monkeyrunner.
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
com.android.monkeyrunner"

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.

Thanks,
Rakesh





-- 

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?