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. Open-Source Repository

Guys,

I'm re-opening the JVending project, which has been inactive (publicly) for
a couple of years. There has been some chatter from individuals interested
in an open-source repository for Android so I think it will be a good start.
You can basically think of it as an Android delivery system where you can
filter and deliver content based on type of device. For example filtering
out Android 2.1+ content for Android 1.5 devices. Things like matching rules
and device profiles are configured through configurations files. You can
plugin specialized delivery adapters if you have specialized content to
deliver to the Android device.

It also handles localization, versioning of apps, variations, etc.

JVending is the building block for a larger system so this project is really
for developers who can dive in and customize the front-end and/or back-end
services that they need. If you want to donate some front-end web
functionality (or anything else), I'll add it to the core project. I'll also
be hosting a dev version for people to try out the latest build changes. I
can also see putting up a production server for open-source android apps at
some point.

Some changes in the project:

1) Moving the license from LGPL to ASL2.
2) I've refactored the code collapsing a number of modules
3) Significant performance optimizations in Hibernate
4) Android Events Database

In the upcoming commit, I'm also hemorrhaging a number of archaic aspects of
JVending like the provisioning archive and stocking api, which made sense 8
years ago but with the size of applications growing significantly (a 300KB
application at that time was considered huge, most were 50-60KB), these
things don't make sense. So I'll be moving away from the JSR-124 spec toward
something more appropriate to today's mobile environment.

I still need to add a module for the webservice itself, which will be out
shortly, but feel free to dive in.

http://github.com/sisbell/jvending

I've also opened up the* jam *project (JVending Application Manager), which
will be an open-source download and discovery manager. A lot of people have
been interested in this part of the project.

http://github.com/sisbell/jam

I'm not putting any code out there yet till things like the feeds go up in
the webservice. Once the community decides what the feeds to the mobile
client should look like, we can build out the client. For SlideME, I had a
simple, custom format for the feeds, but am thinking to use JSON or
something similar to standardize it.

Feel free to open any issues on github, submit patches, follow, make
comments, etc. After a few good patches, I usually offer people to become a
committer on the project.

-- 
Shane Isbell (Founder of ZappMarket)
http://apps.facebook.com/zappmarket/

-- 

2. Home button in Beagle board

Hi All,

I am testing some android apps in a beagle board with Android 2.1. But
I came to know that there is no home button in the board. I have to
test some home apps also. How will I get the Home Button press?? Is
there any way to do this?

Thanks,
SREEHARI

-- 

3. WebGL and O3D on DroidX

4. Fwd: copybit format conversion issue, for help

5. Changing from one dev machine to another, keystore question

6. kernel panic at keyguard screen

7. BluetoothFtp