Android getting the clicked value from an alert box
<p>I have an alert box with a list of channels.</p>

<p>I would like to get the value of the clicked channel.</p>

<p>Is this possible?</p>

<p>I have this so far..</p>

<pre><code>  public void ShowChannelDialog(){

      String[] channels = new String[_publicChannels.size()];
      channels = _publicChannels.toArray(channels);

      AlertDialog.Builder showChannel = new AlertDialog.Builder(this);
      showChannel.setTitle("Channel List ("+(_publicChannels.size()-1)+" channels)");


      showChannel.setItems(channels, new DialogInterface.OnClickListener() {

        public void onClick(DialogInterface dialog, int item) {
            _publicChannels.clear();
            if (item == (_publicChannels.size())) {
                System.out.println("NEW CHANNEL");
                CreateNewChannel();
                dialog.dismiss();
            }else{
                String channel = String.valueOf(item);
                System.out.println("Selected: " + channel);
            }
        }
    });
</code></pre>

<p>String.valueof(item) only gives me the int value in the array, I want the actual text value.</p>

<p>Thank you!</p>
