Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created February 4, 2019 17:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/88009b630ba7100ee2f44c8f59476114 to your computer and use it in GitHub Desktop.
Save parzibyte/88009b630ba7100ee2f44c8f59476114 to your computer and use it in GitHub Desktop.
public int guardarCambios(Mascota mascotaEditada) {
SQLiteDatabase baseDeDatos = ayudanteBaseDeDatos.getWritableDatabase();
ContentValues valoresParaActualizar = new ContentValues();
valoresParaActualizar.put("nombre", mascotaEditada.getNombre());
valoresParaActualizar.put("edad", mascotaEditada.getEdad());
// where id...
String campoParaActualizar = "id = ?";
// ... = idMascota
String[] argumentosParaActualizar = {String.valueOf(mascotaEditada.getId())};
return baseDeDatos.update(NOMBRE_TABLA, valoresParaActualizar, campoParaActualizar, argumentosParaActualizar);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment