Skip to content

Instantly share code, notes, and snippets.

@gogeta95
Last active January 23, 2017 12:32
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 gogeta95/33d4765509cfc9fd0e1b241dbff37dcb to your computer and use it in GitHub Desktop.
Save gogeta95/33d4765509cfc9fd0e1b241dbff37dcb to your computer and use it in GitHub Desktop.
Rxjava remove query
public void removeMovie(final int id) {
Observable.fromCallable(new Func0<Integer>() {
@Override
public Integer call() {
return database.delete(MyDatabaseHelper.TABLE_FAVORITES, MyDatabaseHelper.COLUMN_ID + " = " + id, null);
}
}).subscribeOn(Schedulers.io())
.observeOn(Schedulers.io())
.subscribe(new Action1<Integer>() {
@Override
public void call(Integer integer) {
Log.d(TAG, integer+" Deleted");
}
}, new Action1<Throwable>() {
@Override
public void call(Throwable throwable) {
throwable.printStackTrace();
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment