title: INTEGER PRIMARY KEY AUTOINCREMENT in Android not working
body: <p>I have the following code:    </p>
  
  <pre><code>package com.example.mayur.myapplication;
  
  import android.database.sqlite.SQLiteDatabase;
  import android.database.sqlite.SQLiteOpenHelper;
  import android.database.Cursor;
  import android.content.Context;
  import android.content.ContentValues;
  import android.util.Log;
  
  import java.util.ArrayList;
  
  
  public class dbhandler extends SQLiteOpenHelper{
  
      private static final int DATABASE_VERSION = 1;
      private static final String DATABASE_NAME="database1.db";
      private static final String TABLE_NAME= "Database";
      private static final String _ID="_id";
      private static final String COLUMN_NAME="Name";
      private static final String COLUMN_TITLE="Title";
  
  
  
  
      public dbhandler(Context context, String name, SQLiteDatabase.CursorFactory factory, int version) {
          super(context, DATABASE_NAME, factory, DATABASE_VERSION);
      }
  
  
      @Override
      public void onCreate(SQLiteDatabase db) {
          String query = "CREATE TABLE " + TABLE_NAME +" (_ID  INTEGER PRIMARY KEY AUTOINCREMENT,COLUMN_Name TEXT, COLUMN_Title TEXT)";
          db.execSQL(query);
  
      }
  
      @Override
      public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
              db.execSQL("DROP TABLE IF EXISTS TABLE_NAME");
              onCreate(db);
      }
      public void addproduct(Database database)
      {
          ContentValues values=new ContentValues();
          values.put(COLUMN_TITLE,database.get_title());
          values.put(COLUMN_NAME,database.get_name());        
          SQLiteDatabase db=this.getWritableDatabase();
          db.insert(TABLE_NAME, null, values);
          db.close();
  
      }
      public void deleteproduct(String name)
      {
          SQLiteDatabase db =getWritableDatabase();
          db.execSQL("DELETE FROM " + TABLE_NAME + " WHERE " + COLUMN_NAME + "=\"" + name + "\"; ");
      }
  
      public ArrayList&lt;Database&gt; load()
      {
          Database d=new Database();
          ArrayList&lt;Database&gt; ret = new ArrayList&lt;&gt;();
          SQLiteDatabase db=getWritableDatabase();
          String query="SELECT * FROM " +  TABLE_NAME + " WHERE 1";
          Cursor c=db.rawQuery(query,null);
          c.moveToFirst();
          for(int i=0;i&lt;c.getCount();i++)
          {
              d.set_name(c.getString(c.getColumnIndex("Name")));
              d.set_title(c.getString(c.getColumnIndex("Title")));
              ret.add(d);
              c.moveToNext();
  
                  Log.d("id", "load: "+ ret.get(i).get_id());
          }
          db.close();
  
          return rSQLt;
      }
  }
  </code></pre>
  
  <p>logd always shows id=0 inside the load method for all the iterations. I have also tried removing autoincrement but it doesn't work because every time I try to print data from SQLite database it always prints the last entry. Please help.</p>