Is it possible to insert into the SQLITE database using the db.insert method with the value of the identifier manual ID [PRIMARY KEY AUTO INCREMENT]? Or should I do this using the rawQuery method using the SQL command?
mylibman ... // Is a custom class containing all values
SQLiteDatabase db = this.getWritableDatabase();
ContentValues values = new ContentValues();
//values.put(KEY_ID, mylibman.getBookid()); //If I put this line, ID always becomes zero
values.put(KEY_NAME, mylibman.getBookname());
values.put(KEY_PRINT_NAME, mylibman.getPrintname());
long numrow = db.insert(TABLE_NAME, null, values);
db.close();
Thanks,
source
share