Last active
January 23, 2017 12:32
-
-
Save gogeta95/33d4765509cfc9fd0e1b241dbff37dcb to your computer and use it in GitHub Desktop.
Rxjava remove query
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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