Hi i have issue with database SQLITE android
please check my code for reference
when i am going to insert values it returns -1 that i come to know from debug
which is not inserting values so tell me what is wrong
i am inserting value from list view.
public void add_device(String data,
ArrayList<HashMap<String, String>> jsonlist) {
try {
SQLiteDatabase db = this.getReadableDatabase();
// database = this.getWritableDatabase();
for (HashMap<String, String> map : jsonlist) {
ContentValues values = new ContentValues();
values.put(SAVE_COLUMN_NAME, data);
values.put(SAVE_COLUMN_KEY, map.get(SAVE_COLUMN_KEY));
values.put(SAVE_COLUMN_VALUE, map.get(SAVE_COLUMN_VALUE));
@SuppressWarnings("unused")
Long int1 = db.insert(SAVE_TABLE_NAME, null, values);
Log.i("insserted value ", int1 + "");
}
}
/*
* for(HashMap<String, String> map : mylist){ ContentValues cv = new
* ContentValues(); cv.put(FILE_NAME, map.get(FILE_NAME)); cv.put(DESC,
* map.get(DESC)); cv.put(UPLOADED_BY, map.get(DATE_UPLOADED));
* cv.put(ACTION, map.get(FILE_NAME)); cv.put(ID, map.get(ID));
* cv.put(FILE_URI, map.get(FILE_URI)); db.insert("tablename", null,
* cv); }
*/
catch (Exception e) {
// TODO: handle exception
}
}
thanks in advance
TODO: handle exception: do that!