i inserted a string, date, time and int value into an sqlite database using this code
void addRemAction(RemActions remaction) {
SQLiteDatabase db = this.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(KEY_ACTOINS_TITLE, remaction.getTitle()); // Action title
values.put(KEY_ACTIONS_MSG, remaction.getMsg()); // action msg
values.put(KEY_ACTIONS_DATE, dateFormat.format(new Date())); // action date
values.put(KEY_ACTIONS_TIME, remaction.getTime()); // action time
values.put(KEY_ACTIONS_PLACE_LONG, remaction.getPlong()); // action place long
values.put(KEY_ACTIONS_PLACE_LAT, remaction.getPlat()); // action place lat
// Inserting Row
db.insert(TABLE_ACTIONS, null, values);
db.close(); // Closing database connection
and this is my code to retrieve it
RemActions getRemAction(int id) {
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.query(TABLE_ACTIONS, new String[] {KEY_ACTOINS_TITLE, KEY_ACTIONS_MSG, KEY_PLACES_NAME, KEY_ACTIONS_DATE, KEY_ACTIONS_TIME}, KEY_ACTIONS_ID + "=?",
new String[] { String.valueOf(id) }, null, null, null, null);
if (cursor != null)
cursor.moveToFirst();
RemActions remActions = new RemActions(cursor.getString(0),
cursor.getString(1), cursor.getString(2), cursor.getString(3), cursor.getInt(4));
// return remActions
return remActions;
now my ide is giving me errors because the 4th argument in my constructor for the RemAction class is of type Date from the java.util.date class.
My question is "how do i set the cursor to get it in a date format?"
ill b glad to provide additional code on request