title: How do i send data to my custom adapter
body: <p>After several tries to get a custom adapter working I am almost there. Now I have one problem left: get data in the adapter. This is what I do. </p>
  
  <p>I have a <code>CustomListAdapter</code> class for the adapter, a <code>sqLiteHelper</code> class to CRUD data and a <code>mainActivity</code> class. In the mainActivity i load the customlist like this:</p>
  
  <pre><code>ListView list;
  CustomListAdapter adapter;
  public  MainActivity CustomListView = null;
  public  ArrayList&lt;Players&gt; CustomListViewValuesArr = new ArrayList&lt;Players&gt;();
  
  //button handlers newmatch_players_home
  public void addSpelerNu(View button) {
  
      Log.d("WedstrijdID buiten de create", ""+wedstrijdId);
      Log.d("id return team thuis", ""+thuisTeamId);
      //thuisteam
      final EditText shirtNummer = (EditText) findViewById(R.id.shirtThuis);
      String nummerShirt = shirtNummer.getText().toString();
      int shirtSpeler = Integer.parseInt(nummerShirt);
      final EditText spelerNaam = (EditText) findViewById(R.id.naamThuis);
      String naamSpeler = spelerNaam.getText().toString();
  
      Integer wedstrijdSpelerId = (int) (long) wedstrijdId;
      SqLiteHelper db = new SqLiteHelper(this);
      db.addSpeler(new Players(shirtSpeler, naamSpeler, thuisTeamId, wedstrijdSpelerId));
      Log.d("Toevoegen speler THUIS", "&gt;&gt; BEGIN");
      Log.d("Toevoegen speler", "Shirt = "+nummerShirt+" Naam = "+naamSpeler +" Team ="+thuisTeamId+" Wedstrijd ="+wedstrijdSpelerId);
       Log.d("Toevoegen speler", "&gt;&gt; EIND");
  
       shirtNummer.setText(null);
       spelerNaam.setText(null);
  
  
       CustomListView = this;
  
       /******** Take some data in Arraylist ( CustomListViewValuesArr ) ***********/
  
       ArrayList &lt;Players&gt; CustomListViewValuesArr = new ArrayList&lt;Players&gt;();    
  
      Resources res =getResources();
       list=  ( ListView )findViewById( R.id.listHome );  
  
       /**************** Create Custom Adapter *********/
       adapter=new CustomListAdapter( CustomListView, CustomListViewValuesArr);
       list.setAdapter( adapter );
  
  
  
  }
  </code></pre>
  
  <p>This works except for the data. The data I want to use is in my <code>sqlitehelper</code></p>
  
  <pre><code>public ArrayList&lt;Players&gt; getPlayersForTeam(int teamNumber,int matchNumber) {
          ArrayList&lt;Players&gt; speler = new ArrayList&lt;Players&gt;();
  
          String query = "SELECT  * FROM " + TABLE_SPELERS + " WHERE team=? AND wedstrijd =?";
  
          SQLiteDatabase db = this.getWritableDatabase();
          String[] selectionArgs = new String[] { Integer.toString(teamNumber), Integer.toString(matchNumber) };
          Cursor cursor = db.rawQuery(query, selectionArgs);
  
          Players spelers = null;
          if (cursor.moveToFirst()) {
              do {
               spelers = new Players();
               spelers.setIdSpeler(Integer.parseInt(cursor.getString(0)));
               spelers.setShirt(Integer.parseInt(cursor.getString(1)));
               spelers.setSpeler(cursor.getString(2));
               spelers.setTeam(Integer.parseInt(cursor.getString(3)));
               spelers.setSpelerWedstrijd(Integer.parseInt(cursor.getString(4)));
  
  
                  speler.add(spelers);
              } while (cursor.moveToNext());
          }
  
  
          Log.d("Alle spelers in DB for team:" + teamNumber, speler.toString());
  
          // return wedstrijden
          return speler;
      }
  </code></pre>
  
  <p>If I load this data like this </p>
  
  <pre><code>List &lt;Players&gt; list = new ArrayList&lt;Players&gt;(); 
  list=db.getPlayersForTeam(thuisTeamId,wedstrijdSpelerId);    
  </code></pre>
  
  <p>I will see the log.d in logcat. But I just can't get that data into my <code>CustomListViewValuesArr</code>.</p>
  
  <p>What should I do?</p>
  
  <p>This is the <code>customListAdapter</code> class</p>
  
  <pre><code>package com.jd.wedstrijdkaart;
  
  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.BaseAdapter;
  import android.widget.TextView;
  
  public class CustomListAdapter extends BaseAdapter {
  
               /*********** Declare Used Variables *********/
               private Activity activity;
               private ArrayList data;
               private static LayoutInflater inflater=null;
               Players tempValues=null;
               int i=0;
  
               /*************  CustomAdapter Constructor 
               * @return *****************/
               public CustomListAdapter(Activity a, ArrayList d) {
  
                      /********** Take passed values **********/
                       activity = a;
                       data=d;
  
                       /***********  Layout inflator to call external xml layout () ***********/
                        inflater = ( LayoutInflater )activity.
                                                    getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  
               }
  
               /******** What is the size of Passed Arraylist Size ************/
               public int getCount() {
  
                   if(data.size()&lt;=0)
                       return 1;
                   return data.size();
               }
  
               public Object getItem(int position) {
                   return position;
               }
  
               public long getItemId(int position) {
                   return position;
               }
  
               /********* Create a holder Class to contain inflated xml file elements *********/
               public static class ViewHolder{
  
                   public TextView shirt;
                   public TextView name;
  
               }
  
               /****** Depends upon data size called for each row , Create each ListView row *****/
               public View getView(int position, View convertView, ViewGroup parent) {
  
                   View vi = convertView;
                   ViewHolder holder;
  
                   if(convertView==null){
  
                       /****** Inflate tabitem.xml file for each row ( Defined below ) *******/
                       vi = inflater.inflate(R.layout.adapter_players, null);
  
                       /****** View Holder Object to contain tabitem.xml file elements ******/
  
                       holder = new ViewHolder();
                       holder.shirt = (TextView) vi.findViewById(R.id.shirt);
                       holder.name=(TextView)vi.findViewById(R.id.name);
  
                      /************  Set holder with LayoutInflater ************/
                       vi.setTag( holder );
                   }
                   else 
                       holder=(ViewHolder)vi.getTag();
  
                   if(data.size()&lt;=0)
                   {
                       holder.name.setText("No Data");
  
                   }
                   else
                   {
                       /***** Get each Model object from Arraylist ********/
                      tempValues = null;
                       tempValues = ( Players ) data.get( position );
  
                       /************  Set Model values in Holder elements ***********/
  
                        holder.shirt.setText( tempValues.getShirt() );
                        holder.name.setText( tempValues.getSpeler() );
  
  
  
                   }
                   return vi;
               }
  
  
           }
  </code></pre>