rx.android.schedulers.HandlerScheduler Java Examples
The following examples show how to use
rx.android.schedulers.HandlerScheduler.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MainActivity.java From RxJava_RxAndroid with Apache License 2.0 | 6 votes |
void onRunSchedulerExampleButtonClicked() { sampleObservable() // Run on a background thread .subscribeOn(HandlerScheduler.from(backgroundHandler)) // Be notified on the main thread .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Subscriber<String>() { @Override public void onCompleted() { Log.d(TAG, "onCompleted()"); } @Override public void onError(Throwable e) { Log.e(TAG, "onError()", e); } @Override public void onNext(String string) { Log.d(TAG, "onNext(" + string + ")"); } }); }
Example #2
Source File: MainActivity.java From android-samples with Apache License 2.0 | 6 votes |
void fetchSongs(String url) { songsObservable(url) // Run on a background thread .subscribeOn(HandlerScheduler.from(backgroundHandler)) // Be notified on the main thread .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Subscriber<List<Song>>() { @Override public void onCompleted() { Log.d(getClass().getSimpleName(), "onCompleted()"); progressDialog.dismiss(); } @Override public void onError(Throwable e) { Log.e(getClass().getSimpleName(), "onError()", e); Toast.makeText(MainActivity.this, e.getMessage(), Toast.LENGTH_LONG).show(); } @Override public void onNext(List<Song> songs) { recyclerView.setAdapter(new JsonAdapter(songs)); } }); }
Example #3
Source File: MainActivity.java From android-samples with Apache License 2.0 | 6 votes |
void fetchSongs(String url) { songsObservable(url) // Run on a background thread .subscribeOn(HandlerScheduler.from(backgroundHandler)) // Be notified on the main thread .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Subscriber<List<Song>>() { @Override public void onCompleted() { Log.d(getClass().getSimpleName(), "onCompleted()"); progressDialog.dismiss(); } @Override public void onError(Throwable e) { Log.e(getClass().getSimpleName(), "onError()", e); Toast.makeText(MainActivity.this, e.getMessage(), Toast.LENGTH_LONG).show(); } @Override public void onNext(List<Song> songs) { recyclerView.setAdapter(new JsonAdapter(songs)); } }); }