Skip to content

Instantly share code, notes, and snippets.

@AndrewReitz
Created November 22, 2014 14:58
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 AndrewReitz/076ddfe7122fd78da5a3 to your computer and use it in GitHub Desktop.
Save AndrewReitz/076ddfe7122fd78da5a3 to your computer and use it in GitHub Desktop.
Anbdroid RxCursorLoader
Observable.create(new Observable.OnSubscribe<T>() {
@Override public void call(Subscriber<? super T> subscriber) {
final Cursor cursor = cursorLoader.getCursor();
if (cursor.moveToFirst()) {
while (!cursor.isAfterLast()) {
if (!subscriber.isUnsubscribed()) {
subscriber.onNext(cursor));
cursor.moveToNext();
}
}
}
cursor.close();
subscriber.onCompleted();
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment