title: How to make a checkbox from information found in DataBase?
body: <p>I have a table in DataBase, and I want to make a table.
  Now it makes no sense that I will do a lot of CheckBox and show you only some of them according to the information in the table. I heard about the <a href="/questions/tagged/listview" class="post-tag" title="show questions tagged &#39;listview&#39;" rel="tag">listview</a>
  But how do I do <a href="/questions/tagged/listview" class="post-tag" title="show questions tagged &#39;listview&#39;" rel="tag">listview</a> of <a href="/questions/tagged/checkbox" class="post-tag" title="show questions tagged &#39;checkbox&#39;" rel="tag">checkbox</a> I found an example of <a href="/questions/tagged/listview" class="post-tag" title="show questions tagged &#39;listview&#39;" rel="tag">listview</a> on the Internet and when I tried to insert large information, only half the information came in, so I was told to do <a href="/questions/tagged/adapter" class="post-tag" title="show questions tagged &#39;adapter&#39;" rel="tag">adapter</a>.
  Do you have an example of how to do this?</p>
  
  <p>It DatabaseHandler:</p>
  
  <pre><code>package budgetreport.com.budgetreport;
  
  public class DatabaseHandler extends SQLiteOpenHelper {
  
      // All Static variables
      // Database Version
      private static final int DATABASE_VERSION = 4;
  
      // Database Name
      private static final String DATABASE_NAME = "Records_Item Purcashes";
  
      // Contacts table name
      private static final String TABLE_RECORDS = "Records";
  
      // Contacts Table Columns names
      private static final String KEY_ID = "ID";
      private static final String KEY_PRICE = "Price";
      private static final String KEY_ITEM = "Item";
      private static final String KEY_DETAILS = "Details";
      private static final String KEY_DATE = "Date";
  
      public DatabaseHandler(Context context) {
          super(context, DATABASE_NAME, null, DATABASE_VERSION);
      }
  
      // Creating Tables
      @Override
      public void onCreate(SQLiteDatabase db) {
          String CREATE_CONTACTS_TABLE = "CREATE TABLE " + TABLE_RECORDS + "("
                  + KEY_ID + " INTEGER PRIMARY KEY,"
                  + KEY_PRICE + " INTEGER," + KEY_ITEM + " TEXT,"
                  + KEY_DETAILS + " TEXT, " + KEY_DATE + " TEXT" + ")";
          db.execSQL(CREATE_CONTACTS_TABLE);
      }
  
      // Upgrading database
      @Override
      public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
          // Drop older table if existed
          db.execSQL("DROP TABLE IF EXISTS " + TABLE_RECORDS);
  
          // Create tables again
          onCreate(db);
      }
      // Adding new contact
      public void addRecord(Record record) {
          SQLiteDatabase db = this.getWritableDatabase();
  
          ContentValues values = new ContentValues();
  
          values.put(KEY_ID, record.getId()); // Contact Name
          values.put(KEY_PRICE, record.getPrice()); // Contact Name
          values.put(KEY_ITEM, record.getItem()); // Contact Name
          values.put(KEY_DETAILS, record.getDetails()); // Contact Name
          values.put(KEY_DATE, record.getDetails()); // Contact Phone Number
  
          // Inserting Row
          db.insert(TABLE_RECORDS, null, values);
          db.close(); // Closing database connection
      }
      // Getting single contact
      public Record getRecord(int id) {
          SQLiteDatabase db = this.getReadableDatabase();
  
          Cursor cursor = db.query(TABLE_RECORDS, new String[] { KEY_ID, KEY_PRICE,
                          KEY_ITEM, KEY_DETAILS, KEY_DATE }, KEY_ID + "=?",
                  new String[] { String.valueOf(id) }, null, null, null, null);
          if (cursor != null)
              cursor.moveToFirst();
  
          Record record = new Record(Integer.parseInt(cursor.getString(0)),
                  Integer.parseInt(cursor.getString(1)), cursor.getString(2), cursor.getString(3), cursor.getString(4));
          // return contact
          return record;
      }
      // Getting All Contacts
      public List&lt;Record&gt; getAllContacts() {
          List&lt;Record&gt; contactList = new ArrayList&lt;Record&gt;();
          // Select All Query
          String selectQuery = "SELECT  * FROM " + TABLE_RECORDS;
  
          SQLiteDatabase db = this.getWritableDatabase();
          Cursor cursor = db.rawQuery(selectQuery, null);
  
          // looping through all rows and adding to list
          if (cursor.moveToFirst()) {
              do {
                  Record record = new Record();
                  record.setId(Integer.parseInt(cursor.getString(0)));
                  record.setPrice(Integer.parseInt(cursor.getString(1)));
                  record.setItem(cursor.getString(2));
                  record.setDetails(cursor.getString(3));
                  record.setDate(cursor.getString(4));
  
                  // Adding contact to list
                  contactList.add(record);
              } while (cursor.moveToNext());
          }
  
          // return contact list
          return contactList;
      }
      // Getting contacts Count
      public int getRecordsCount() {
          String countQuery = "SELECT  * FROM " + TABLE_RECORDS;
          SQLiteDatabase db = this.getReadableDatabase();
          Cursor cursor = db.rawQuery(countQuery, null);
         // cursor.close();
  
          // return count
          return cursor.getCount();
      }
      // Updating single contact
      public int updateContact(Record record) {
          SQLiteDatabase db = this.getWritableDatabase();
  
          ContentValues values = new ContentValues();
          values.put(KEY_ID, record.getId());
          values.put(KEY_PRICE, record.getPrice());
          values.put(KEY_DETAILS, record.getDetails());
          values.put(KEY_DATE, record.getDate());
  
          // updating row
          return db.update(TABLE_RECORDS, values, KEY_ID + " = ?",
                  new String[] { String.valueOf(record.getPrice()) });
      }
      // Deleting single contact
      public void deleteContact(Record record) {
          SQLiteDatabase db = this.getWritableDatabase();
          db.delete(TABLE_RECORDS, KEY_ID + " = ?",new String[] 
         {String.valueOf(record.getPrice()) });
          db.close();
      }
  }
  </code></pre>