コード例 #1
0
  public void insertTravel(Travel travel) {
    SQLiteDatabase db = getReadableDatabase();

    ContentValues values = new ContentValues();
    values.put(TravelsConstants.CITY, travel.getCity());
    values.put(TravelsConstants.COUNTRY, travel.getCountry());
    values.put(TravelsConstants.YEAR, travel.getYear());
    values.put(TravelsConstants.NOTE, travel.getNote());
    values.put(TravelsConstants.IMAGE_VIAJE, travel.getImage());

    db.insert(TABLE_NAME, null, values);
  }
コード例 #2
0
  public void updateTravel(Travel travel) {
    SQLiteDatabase db = getReadableDatabase();

    ContentValues values = new ContentValues();
    values.put(TravelsConstants.CITY, travel.getCity());
    values.put(TravelsConstants.COUNTRY, travel.getCountry());
    values.put(TravelsConstants.YEAR, travel.getYear());
    values.put(TravelsConstants.NOTE, travel.getNote());
    values.put(TravelsConstants.IMAGE_VIAJE, travel.getImage());

    db.update(TABLE_NAME, values, TravelsConstants._ID + "=" + travel.getIdTravel(), null);
  }