title: How to use setMultiChoiceItems() with a Custom AlertDialog that uses an efficiency arrayadapter?
body: <p>I am writing a music player that uses a custom Adapter extending BaseAdapter (efficiency adapter) that I want to display in an <code>AlertDialog</code> using <code>setAdapter()</code> where the user can either click on one of the songs to switch to that position in the playlist OR check songs to remove from the playlist. I tried using a custom click listener so that a user could just long click to remove the item from the list but the <code>listview</code> just doesn't work right... it was removing the wrong items (the ones at the end) even though the <code>ArrayList</code> contained the correct playlist items... (when I removed the item from the <code>ArrayList</code>, I passed it to the adapter which called <code>notifyDataSetChanged</code>... but that just didn't work as I mentioned. There is definitely a bug in the <code>AlertDialog ListView</code>... because there is no reason for it to have popped off the results from the end rather than the correct item.</p>
  
  <p>So... the next method I would like to try is to use the <code>setMultiChoiceItems()</code> method of the <code>AlertDialog</code>... but it appears that it doesn't work with a custom adapter... only simple arrays. Will I have to subclass <code>AlertDialog</code> and <code>Override</code> the <code>setMultiChoiceItems()</code> method or is there a way I can make it work with an <code>ArrayAdapter</code>?</p>
  
  <p>Basically, I can't figure out how to even iterate the list that the <code>AlertDialog</code> creates or whether it even passes that view somehow. In addition, I don't think I can even listen to clicks on <code>checkboxes</code> if I add those to the row. Any help will be greatly appreciated.</p>
  
  <p>EDIT: Asking questions here is like magic... I answered my own question... this is how I did it. I added a hint to each <code>checkbox</code> which is the position of the item in the <code>ArrayList</code>. Then I used <code>OnCheckedChangeListener</code> to capture the selections. When you set a hint it adds text to the <code>checkbox</code>... since the background of the <code>AlertDialog</code> is white (even for clicked items?) I just set the hint text color to transparent.</p>
  
  <pre><code>holder.check.setHintTextColor(Color.TRANSPARENT);
  holder.check.setHint(String.valueOf(position));
  holder.check.setOnCheckedChangeListener(new OnCheckedChangeListener() {
  
  public void onCheckedChanged(CompoundButton buttonView,
              boolean isChecked) {
          int position = Integer.parseInt((String) buttonView.getHint());
          Log.v("onCheckedChanged", "Checked: "+isChecked+" returned: "+position+" which should be "+getItem(position).name);                         
      }
  
  });
  </code></pre>