sqlite3 - Android SQLiteConstraintException: error code 19: constraint failed -


i have seen other questions this, none of answers seemed work code. i'm getting 'sqliteconstraintexception: error code 19: constraint failed' error when try insert db. here code insert operation

@override     public void oncreate(sqlitedatabase db) {         db.execsql("create table " + data_table + "(" + key_id                 + " integer primary key autoincrement," + key_name                 + " text not null," + key_type + " text);");                 }     public static  void insert_data(string name, string type) {      mdb = dbhelper.getwritabledatabase();     contentvalues iv = new contentvalues();     iv.put(key_name, name);     iv.put(key_type, type);      mdb.insert(data_table, null, iv);  } 

in activity inserting values database

   db.insert_data("all value", "all artist");//my constrain error points here 


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -