Ejemplo n.º 1
0
  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();
  }
Ejemplo n.º 2
0
  public void deleteSms(Sms sms) {
    long id = sms.getId();

    database.delete(MySQLiteHelper.TABLE_SMS, MySQLiteHelper.COLUMN_SMS_ID + " = " + id, null);
  }