In my app i am adding the row in database. But the rowid is coming 1 two time earlier. What could be problem ?
long rowId=getWritableDatabase().insert(TABLE_MEDIA_DETAILS, null, contentValues);
Hello,
The table creation is as follow.
db.execSQL("CREATE TABLE " + TABLE_MEDIA_DETAILS + " (" + COLUMN_PROJECT_ID + " LONG," + COLUMN_MEDIA_ID + " LONG," + COLUMN_MEDIA_SEQUENCE
+ " INTEGER," + COLUMN_MEDIA_PATH + " TEXT," + COLUMN_MEDIA_TYPE + " TEXT,"+ COLUMN_TITLE_STYLE + " TEXT,"+ COLUMN_TITLE_TEXT + " TEXT,"
+ COLUMN_IMAGE_DURATION + " INTEGER," + COLUMN_TRIM_LEFT + " INTEGER," + COLUMN_TRIM_RIGHT + " INTEGER,"
+ "PRIMARY KEY( " + COLUMN_PROJECT_ID + ","
+ COLUMN_MEDIA_SEQUENCE + " ));");
as you can see i have already primary key for the combination of two colum like project_id and column_media_sequence so i can not have another primary key in that table so i can not create another one.
If I managed to understand your question right –
Make sure you are adding
AUTOINCREMENTwhen you create your tablefor example
and don’t send a value of your ID column in your contentValues..