title: What will adapter.getItem() return?
body: <p>I have created a custom array adapter for my custom ListView, which has TextViews and a Checkbox. In my customadapter I created a method called isChecked() -</p>
  
  <pre><code>    static class personHolder
      {
          TextView txtName;
          TextView txtNumber;
          CheckBox checkbox;
          public boolean isChecked(){
              boolean isChecked_boolean = false; ///this holds the return value, of whether the checkbox is checked or not.
              if(checkbox.isChecked()){
                  isChecked_boolean = true;
              }
              else{
                  isChecked_boolean = false;
              }
              return isChecked_boolean;
          }
      }
  }
  </code></pre>
  
  <p>OK. I know use a loop that iterates through my view like so:</p>
  
  <pre><code>public ArrayList&lt;PeopleDetails&gt; checkbox_SMS(ListAdapter adapter){
      ArrayList&lt;PeopleDetails&gt; people_SMS = new ArrayList&lt;PeopleDetails&gt;();
      for(int i = 0; i &lt; adapter.getCount(); i++){
          if(((personHolder) adapter.getItem(i)).isChecked() == true){
              people_SMS.add((PeopleDetails) people_details.toArray()[i]);
              ///adds the corresponing people_details item to the arraylist of PeopleDetails, to send SMS messages to.
          }
      }
      return people_SMS; ///returns the list.
  
  }
  </code></pre>
  
  <p>However I get an error at the line if(((personHolder) adapter.getItem(i)).isChecked() == true) saying that it cannot cast from PeopleDetails to personHolder. PeopleDetails is the type that I pass to my customadapter for the data in the TextViews. What have I done wrong?</p>
  
  <p>QUESTION - What should that line be to properly get the result I want? Thanks for the help!!</p>
  
  <pre><code>package com.example.partyorganiser;
  
  import java.util.ArrayList;
  
  import android.app.Activity;
  import android.content.Context;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.ArrayAdapter;
  import android.widget.CheckBox;
  import android.widget.ImageView;
  import android.widget.TextView;
  
  public class peoplelist_customadapter extends ArrayAdapter&lt;PeopleDetails&gt;{
  
      Context context; 
      int layoutResourceId;    
      ArrayList&lt;PeopleDetails&gt; data = null;
  
      public peoplelist_customadapter(Context context, int layoutResourceId, ArrayList&lt;PeopleDetails&gt; data) {
          super(context, layoutResourceId, data);
          this.layoutResourceId = layoutResourceId;
          this.context = context;
          this.data = data;
      }
  
      @Override
      public View getView(int position, View convertView, ViewGroup parent) {
          View row = convertView;
          personHolder holder = null;
          PeopleDetails[] people_array = data.toArray(new PeopleDetails[data.size()]);
  
  
          if(row == null)
          {
              LayoutInflater inflater = ((Activity)context).getLayoutInflater();
              row = inflater.inflate(layoutResourceId, parent, false);
  
              holder = new personHolder();
              holder.txtName = (TextView)row.findViewById(R.id.name_txt);
              holder.txtNumber = (TextView)row.findViewById(R.id.number_txt);
              holder.checkbox = (CheckBox) row.findViewById(R.id.checkBox);
              row.setTag(holder);
          }
          else
          {
              holder = (personHolder)row.getTag();
          }
  
          PeopleDetails person = people_array[position];
          holder.txtName.setText(person.name);
          holder.txtNumber.setText(person.number);
  
          ///CheckBox mCheckBox = (CheckBox) mView.findViewById(R.id.checkBox);
  
  
          return row;
      }
      public boolean getView_IsChecked(int position){
  
      }
  
  
  
      static class personHolder
      {
          TextView txtName;
          TextView txtNumber;
          CheckBox checkbox;
          public boolean isChecked(){
              boolean isChecked_boolean = false; ///this holds the return value, of whether the checkbox is checked or not.
              if(checkbox.isChecked()){
                  isChecked_boolean = true;
              }
              else{
                  isChecked_boolean = false;
              }
              return isChecked_boolean;
          }
      }
  }
  </code></pre>