Checkbox List From Database
<pre><code>db=openOrCreateDatabase("WOdb.db", SQLiteDatabase.CREATE_IF_NECESSARY, null);            
            Cursor c=db.rawQuery("SELECT * FROM WorkoutTable", null);
           // ArrayList&lt;String&gt; list  = new ArrayList&lt;String&gt;();

            int count=c.getCount();

            if(c.getCount()&gt;0)
            {
                while(c.moveToNext())
                {
                 inflater=(LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                 //list.add(c.getString(1).toUpperCase()+" \nTarget: "+c.getString(2)+" \nDuration: "+c.getString(3));

                  String wnames = c.getString(1);
                  String target = c.getString(2);
                  String duration = c.getString(3);

                  String names[]={wnames}; 

                  String teams[]={target};

                  Integer[] photos={R.drawable.ic_launcher,R.drawable.ic_launcher,
                            R.drawable.ic_launcher,R.drawable.ic_launcher,
                            R.drawable.ic_launcher,R.drawable.ic_launcher,
                            R.drawable.ic_launcher,R.drawable.ic_launcher};

                  players=new ArrayList&lt;HashMap&lt;String,Object&gt;&gt;();

                  //temporary HashMap for populating the 
                  //Items in the ListView
                  HashMap&lt;String , Object&gt; temp;

                  //total number of rows in the ListView
                  int noOfPlayers=names.length;

                  //now populate the ArrayList players
                  for(int i=0;i&lt;noOfPlayers;i++)
                  {
                   temp=new HashMap&lt;String, Object&gt;();

                   temp.put("name", names[i]);
                   temp.put("team", teams[i]);    
                   temp.put("photo", photos[i]);

                   //add the row to the ArrayList
                   players.add(temp);        
                  }

                  final CustomAdapter adapter=new CustomAdapter(this, R.layout.view_workouts,players); 
                  setListAdapter(adapter);
                }                   
                c.close();
                Toast.makeText(this,"Total Records: "+count, Toast.LENGTH_LONG).show();
                //ArrayAdapter&lt;String&gt; adapter=new ArrayAdapter&lt;String&gt;(this,android.R.layout.simple_list_item_1, list);
                //getListView().setAdapter(adapter);
                //final CustomAdapter adapter=new CustomAdapter(this, R.layout.view_workouts,players); 
                //setListAdapter(adapter);
            }
</code></pre>

<p>i got the list from the database and placed a checkbox and image..the code worked with some some exceptions..there are a total of 4 records in the database but only one record appears with a checkbox. any ideas on how to fix this?</p>
