How to implement a custom code whenever an item in a multiple choice list view is a listview is checked or unchecked? I couldn’t find any suitable article on this.Any help will be much appreciated. Thank you. The following is my code for multiple choice list view.
ListView lv = (ListView) findViewById(R.id.listview);
ArrayList<String> stateList =Handler.getList();
String[] catalogList = new String[stateList.size()];
catalogList=stateList.toArray(catalogList);
lv.setAdapter(new ArrayAdapter<String>(Catalog.this,
android.R.layout.simple_list_item_multiple_choice, catalogList));
You can add onItemClickListener to your listview , on item click check the state of you checkbox and do action you want.
for why see this
you also can do it by implement custom adapter. a dirty example following:
more effective of use adapter take a look this post!