public boolean updateFromServer(List<Nota> listaNotas) { SQLiteDatabase db = MyApp.getContext().openOrCreateDatabase("rescue_lite_db", Context.MODE_PRIVATE, null); boolean result = false; try { db.beginTransaction(); // Delete all records db.delete(TABLE, null, null); // Insert all values ContentValues values; for (Nota nota : listaNotas) { values = new ContentValues(); values.put(NOMBRE, nota.getNombre()); values.put(DESCRIPCION, nota.getDescripcion()); long new_id = db.insertOrThrow(TABLE, null, values); } db.setTransactionSuccessful(); result = true; } catch (SQLException e) { // do some error handling result = false; } finally { db.endTransaction(); } return result; }