Created
November 22, 2014 14:58
-
-
Save AndrewReitz/076ddfe7122fd78da5a3 to your computer and use it in GitHub Desktop.
Anbdroid RxCursorLoader
This file contains 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
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