Retrieving Selected Items from a Multiple Selection List


I am currently implementing a multi-select ListView for my android app. My aim is to retrieve the selected items from the ArrayAdapter associated with the ListView when clicking the search button.

I am currently stumped on how to do this, I have found stuff online such as trying to set a MultiChoiceModeListener, but this does not seem to come up as an option in Eclipse. I am using Google APIs(level 10), Android 2.3.3 equivalent. Here is the code I have so far:

   public class FindPlace extends Activity {    

    public FindPlace() {}

    protected void onCreate(Bundle savedInstanceState) {
        Button search = (Button) findViewById(;
        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(;
        list.setOnItemClickListener(new OnItemClickListener() {
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) { }


Use the method getCheckedItemPosition().