I\'m developing an app and I have one ListActivity
, which has choice mode set to choice_mode_multiple
. now i want to override method, which is called w
Use isItemChecked (int position) or setItemChecked(int position, boolean value) if you using standart array adapter and SINGLE or MULTIPLE choise mode. http://developer.android.com/reference/android/widget/AbsListView.html#isItemChecked(int)
Also you can create your custom adapter and inflate row layout with checkbox that can hold onClickListener and CheckedChangedListener. Use search to find example.
Set onlistitemclick listener to listview , then in itemclick method you can get mylistView.getCheckedItemCount() , write the code of the operation to be performed.
If this is not clear let me know what you want to implement when item is checked.
mylistView = (ListView)customView.findViewById(R.id.mylist);
mylistView.setAdapter(mFolderAdapter);
mylistView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
mylistView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View v,
int arg2, long arg3) {
// TODO Auto-generated method stub
if(mylistView.isItemChecked(arg2)){
//Dooperation
}
// or
if(mylistView.getCheckedItemCount()>1){
//Dooperation
}
}
});