Created
November 15, 2017 09:07
-
-
Save kuanyingchou/7ed9952230438f5c553a4d52ec320a23 to your computer and use it in GitHub Desktop.
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
final Observable<String> o = Observable.create(new ObservableOnSubscribe<String>() { | |
@Override | |
public void subscribe(ObservableEmitter<String> e) throws Exception { | |
for(int i=0; i<10; i++) { | |
if(e.isDisposed()) break; | |
// make request here... | |
e.onNext(String.valueOf(i)); | |
try { | |
Thread.sleep(1000); | |
} catch(InterruptedException ie) {} | |
} | |
e.onComplete(); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment