public void saveSms(Sms sms) { ContentValues values = new ContentValues(); values.put(MySQLiteHelper.COLUMN_SMS_PHONE_NUMBER, sms.getPhoneNumber()); values.put(MySQLiteHelper.COLUMN_SMS_SENDER_NAME, sms.getSenderName()); values.put(MySQLiteHelper.COLUMN_SMS_MESSAGE_TEXT, sms.getMessageText()); values.put(MySQLiteHelper.COLUMN_SMS_TIMESTAMP, sms.getTimestamp()); long insertId = database.insert(MySQLiteHelper.TABLE_SMS, null, values); // Cursor cursor = database.query(MySQLiteHelper.TABLE_SMS, // allColumns, MySQLiteHelper.COLUMN_SMS_ID + " = " + insertId, null, // null, null, null); // cursor.moveToFirst(); // // Sms newSms = cursorToSms(cursor); // cursor.close(); }
public void deleteSms(Sms sms) { long id = sms.getId(); database.delete(MySQLiteHelper.TABLE_SMS, MySQLiteHelper.COLUMN_SMS_ID + " = " + id, null); }