I have been trying to solve what seems like a simple problem for the last 3 days, I am trying to insert a record into an sqlite database from an activity, I have searched for the issue without look. Below you find my activity code and DBHelper code. dbhelper CODE:
public Long insertResult(String QUEST_ID,String test1,String test2) {
SQLiteDatabase db = this.getWritableDatabase();
ContentValues initialValues = new ContentValues();
initialValues.put("Question", QUEST_ID);
initialValues.put("Rights", test1);
initialValues.put("Wrongs", test2);
Log.d("Result:", "Rights " + initialValues.get("Rights"));
return db.insertOrThrow("Results", null, initialValues);
}
from the mainactivity
long ins = myDbHelper.insertResult("test","test2","test3");
Aucun commentaire:
Enregistrer un commentaire