How do we get the value of the ListView check in Android?
For example, if we've got the names and phone numbers of the contacts saved in the phone and shown them in an Android ListView, now the function is to dial directly when you click on the selection, how do you get the number in the Android ListView?
To display the contact name and phone number, you must now have two controls in the ListView item, if it is TextView bar, then you should first add a onitemclicklistener to ListView To monitor the item you clicked, there is a Onitemclick method inside the Onitemclicklistener, which has a view parameter, so you can pass View.findviewbyid ("Your Control name") to find it.
code example:
ListView ListView = (ListView) Findviewbyid (R.id.listview);
Onitemclicklistener lvitemclicklistener=new Onitemclicklistener () {public
void Onitemclick (adapterview parent, View view,
int position, long ID) {
final TextView content= (TextView) View.findviewbyid (r.id.phonenumber);)
}
}
Content is the value you want.
The above is an example of how Android gets the value of the ListView option, and a friend in need can refer to it.