So I have the following pieces of code and I can't seem to get my application to store any information in the SQLite Database, Any help will be appreciated! Below is my database handler.
public void insertRec(HashMap<String, String> queryValues) {
SQLiteDatabase database = this.getWritableDatabase();
ContentValues values = new ContentValues();
values.put("regNo", queryValues.get("regNo"));
values.put("carMake", queryValues.get("carMake"));
values.put("carModel", queryValues.get("carModel"));
database.insert("recs", null, values);
database.close();
}
}
Here is the button code I use to add a new record.
public class Record extends Activity implements OnClickListener{
public void onClick(View view) {
HashMap<String, String> queryValues = new HashMap<String, String>();
queryValues.put("regNo", regNo.getText().toString());
queryValues.put("carMake", carMake.getText().toString());
queryValues.put("carModel", carModel.getText().toString());
controller.insertRec(queryValues);
Aucun commentaire:
Enregistrer un commentaire