Пример #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);
  }