title: How to create list view in with multiple column in android
body: <p>I am a new android programmer how to create list view in android with three column in list view.first and second column show string value and third column show check box.In the above on check box button when i select those button then all are selected automatically.please help me?please write here code any one.thanks in advance. and data retrieve from sqlite data base i will paste my sqlitedatabase class.</p>
  
  <h2>Heading ##StudentListDatabaseHelper</h2>
  
  <pre><code>package com.example.dao;
  
  
  import java.util.ArrayList;
  import java.util.List;
  
  import org.json.JSONArray;
  import org.json.JSONException;
  import org.json.JSONObject;
  
  import com.example.dto.DriverSelectedRouteArrayList;
  
  import android.content.ContentValues;
  import android.content.Context;
  import android.database.Cursor;
  import android.database.sqlite.SQLiteDatabase;
  import android.database.sqlite.SQLiteOpenHelper;
  import android.util.Log;
  
  public class StudentListDatabaseHelper extends SQLiteOpenHelper
  {
      SQLiteDatabase db;
  
  //  ParseDriverSelectedRouteId parseDriverSelectedRouteId = new ParseDriverSelectedRouteId();
  
      //database version
      private final static int DATABASE_VERSION = 3;
  
      //table name
      private final static String TABLE_NAME = "studentlist";
  
      //table column
      private final String KEY_ID = "_id";
      private final String ROUTE_ID  = "route_id";
      private final String KEY_FIRST_NAME = "first_name";
      private final String KEY_MIDDLE_NAME = "middle_name";
      private final String KEY_LAST_NAME = "last_name";
      private final String KEY_PH_NO = "phone_number";
  
      DriverSelectedRouteArrayList driverSelectedRouteArrayList = new DriverSelectedRouteArrayList();
  
  //  list object create for student list
      List&lt;DriverSelectedRouteArrayList&gt; studentList = new ArrayList&lt;DriverSelectedRouteArrayList&gt;();
      //constructor
      public StudentListDatabaseHelper(Context context) 
      {
  
          super(context, "sbtsystem.db", null, DATABASE_VERSION);
          //SQLiteDatabase simpleDb = this.
  
          db = context.openOrCreateDatabase("sbtsystem.db", Context.MODE_PRIVATE,null);
  
  //      Log.d("constructor for database handler====&gt;", "database handler");
      }
  
      @Override
      public void onCreate(SQLiteDatabase db) 
      {
  
          //Log.d("on create method==========================&gt;&gt;&gt;&gt;&gt;", "sql helper class");
          String  CREATE_STUDENT_LIST_TABLE = "CREATE TABLE IF NOT EXISTS "+ TABLE_NAME +"("+
                                              KEY_ID+" INTEGER PRIMARY KEY AUTOINCREMENT,"+   
                                              ROUTE_ID+" INTEGER,"+
                                              KEY_FIRST_NAME+" TEXT,"+ 
                                              KEY_MIDDLE_NAME+" TEXT,"+ 
                                              KEY_LAST_NAME+ " TEXT,"+ KEY_PH_NO +" TEXT"+")";
                      db.execSQL(CREATE_STUDENT_LIST_TABLE);  
                      //Log.d("on create database helper calss", "database helper class on create");
      }
  
      @Override
      public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion)
      {
           db.execSQL("DROP TABLE IF EXISTS "+TABLE_NAME);
          Log.d("on upgrade method in sqlite database helper class=====&gt;", "before on crete method call in onUpgrade method");
           this.onCreate(db);
  
      }
  
      public void insertRecord(DriverSelectedRouteArrayList driverSelectedRouteArrayList) throws JSONException
      {
          this.onUpgrade(db, 0, 2);
          db = this.getWritableDatabase();
          //get list size from driverSelectedRouteArraylist
          int listSize = driverSelectedRouteArrayList.getStudentArrayList().size();
  
  //      Log.d("list size in database helper class", listSize+"");
          String respose = driverSelectedRouteArrayList.getStudentArrayList().toString();
  
  
          JSONArray jsonArray = new JSONArray(respose);
  
              for(int i=0;i&lt;jsonArray.length();i++)
              {
  
                  JSONObject jsonObject = jsonArray.getJSONObject(i);
                  ContentValues values = new ContentValues();
  
                  String routeId = jsonObject.get("route_id").toString();
                  values.put(ROUTE_ID, routeId);
  
                  String firstName = jsonObject.get("first_name").toString();
                  values.put(KEY_FIRST_NAME, firstName);
  
                  String middle_name = jsonObject.get("middle_name").toString();
                  values.put(KEY_MIDDLE_NAME, middle_name);
  
                  String last_name = jsonObject.get("last_name").toString();
                  values.put(KEY_LAST_NAME,last_name);
  
                  String phone_number = jsonObject.get("phone_number").toString();
                  values.put(KEY_PH_NO, phone_number);
  
                  try{
                          //onUpgrade(db, 1, 2);
  //                      Log.d("end insertRecord loop route id", values.getAsString("route_id")+"end insert record loop route id");
                          db.insert(TABLE_NAME, null, values);
                          selectRecord();
  
  //                      Log.d("insert record:: :: :: :: ::", driverSelectedRouteArrayList.getFirst_name());
                          //db.close();
                          //Log.d("insert query", query+"");
  
                      }catch(Exception e)
                      {
                          e.printStackTrace();
                      }
                          Log.d("inser======0-----&gt;", TABLE_NAME+"");
                          //  db.close();
              }
          }
      public &lt;T&gt; List&lt;DriverSelectedRouteArrayList&gt; selectRecord() throws JSONException
      {
          ArrayList&lt;T&gt; studentArrayList = new ArrayList&lt;T&gt;();
  
          String selectQuery = "SELECT * FROM "+TABLE_NAME;
  //      Log.d("select query=-=-=-=-=-=-=-=-=&gt; ", selectQuery);
          //db = this.getReadableDatabase();
          db = this.getWritableDatabase();
          Cursor curser = db.rawQuery(selectQuery, null);
          //Log.d("select all student list=====&gt;", );
          if(curser.moveToFirst())
          {
              do{ 
                      //json object create for stored data
                      JSONObject jsonObjectForStudenntList = new JSONObject();
  
                      /*  int _id = (curser.getInt(curser.getColumnIndex(KEY_ID)));
                        jsonObjectForStudenntList.put("_id", _id);*/
  
                      int _id = driverSelectedRouteArrayList.set_id(curser.getInt(curser.getColumnIndex(KEY_ID)));
                      jsonObjectForStudenntList.put("_id", _id);
                      Log.d("sqlite database values_id",""+_id);
  
                      //Log.d("values from database handler class _id:::::::::--&gt;", (curser.getInt(curser.getColumnIndex(KEY_ID)))+"=====values");
                      String firstName = driverSelectedRouteArrayList.setFirst_name(curser.getString(curser.getColumnIndex(KEY_FIRST_NAME)));
                      jsonObjectForStudenntList.put("firstName", firstName);
  
                  Log.d("first Name=======&gt;&gt;&gt;&gt;&gt;", firstName+"first Name");
  
                      String middleName = driverSelectedRouteArrayList.setMiddle_name(curser.getString(curser.getColumnIndex(KEY_MIDDLE_NAME)));
                      jsonObjectForStudenntList.put("middleName", middleName);
  
                      String lastName = driverSelectedRouteArrayList.setLast_name(curser.getString(curser.getColumnIndex(KEY_LAST_NAME)));
                      jsonObjectForStudenntList.put("lastName", lastName);
  
                      String phoneNumber = driverSelectedRouteArrayList.setPhone_number(curser.getString(curser.getColumnIndex(KEY_PH_NO)));
                      jsonObjectForStudenntList.put("phoneNumber", phoneNumber);
  
  
                      studentList.add(driverSelectedRouteArrayList);
  
                      studentArrayList.add((T) jsonObjectForStudenntList.toString());
  
                  }while(curser.moveToNext());
  
              driverSelectedRouteArrayList.setDriverSelectedRouteArrayList((List&lt;DriverSelectedRouteArrayList&gt;) studentArrayList);
  
              //driverSelectedRouteArrayList.setStudentListInSqliteDatabse((ArrayList&lt;String&gt;) studentList);
  
          //Log.d("all select values from sqlite database******",""+studentArrayList);
          }
          Log.d("driver list==&gt;","nnnnnnnnnnnnn\n"+""+driverSelectedRouteArrayList.getDriverSelectedRouteArrayList());
          return studentList;
      }
  }
  </code></pre>