android - Retrieving the selected items from a multi-select ListView -
i implementing multi-select listview
android app. aim retrieve selected items arrayadapter
associated listview
when clicking search button.
i stumped on how this, have found stuff online such trying set multichoicemodelistener
, not seem come option in eclipse
. using google api
s(level 10), android 2.3.3
equivalent. here code have far:
public class findplace extends activity { public findplace() {} @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.list_places); button search = (button) findviewbyid(r.id.search); string[] categories = getresources().getstringarray(r.array.categories); arrayadapter ad = new arrayadapter(this,android.r.layout.simple_list_item_multiple_choice,categories); final listview list=(listview)findviewbyid(r.id.list); list.setadapter(ad); list.setchoicemode(listview.choice_mode_multiple); list.setonitemclicklistener(new onitemclicklistener() { @override public void onitemclick(adapterview<?> parent, view view, int position, long id) { } }); } }
use method getcheckeditemposition()
.
Comments
Post a Comment