Skip to content

Instantly share code, notes, and snippets.

Last active Jan 30, 2017
What would you like to do?
Observable<Data> dataStream = RxView.clicks(button)
.debounce(2, TimeUnit.SECONDS)
.flatMap(new Func1<Void, Observable<Data>>() {
public Observable<Data> call(Void aVoid) {
Log.d(TAG, "Performing network request...");
return apiEndpoints.getData();
.publish().autoConnect(2) // <-- NEW LINE
dataStream.subscribe(data -> Log.d(TAG, "View one received the data"));
dataStream.subscribe(data -> Log.d(TAG, "View two received the data"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment