Created
August 8, 2016 03:44
-
-
Save pyadav/ed3b91da711402826a92364a44278beb to your computer and use it in GitHub Desktop.
rxjava
This file contains hidden or 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.just("") | |
| .subscribeOn(Schedulers.immediate()).observeOn(Schedulers.io()).doOnSubscribe(() -> { | |
| //tv1.setText("fe"); | |
| }) | |
| .map(x -> { | |
| InitVo initVo = qrHttp.init(); | |
| return initVo; | |
| }) | |
| .map(initVo -> { | |
| LoginResponse loginResponse = qrHttp.login("admin", "admin", initVo); | |
| return loginResponse; | |
| } | |
| ) | |
| .map(loginResponseVo -> { | |
| QuesyResponse quesyResponse = qrHttp.query("", loginResponseVo.getLoginCookies()); | |
| return quesyResponse; | |
| }).subscribe(new Subscriber<QuesyResponse>() { | |
| @Override | |
| public void onCompleted() { | |
| Looper.prepare(); | |
| Toast.makeText(context, "onCompleted", Toast.LENGTH_SHORT).show(); | |
| Looper.loop(); | |
| } | |
| @Override | |
| public void onError(Throwable e) { | |
| Looper.prepare(); | |
| e.printStackTrace(); | |
| Toast.makeText(context, "e:" + e.getCause(), Toast.LENGTH_SHORT).show(); | |
| Looper.loop(); | |
| } | |
| @Override | |
| public void onNext(QuesyResponse quesyResponse) { | |
| Looper.prepare(); | |
| Toast.makeText(context, "msg:" + quesyResponse.getMsg(), Toast.LENGTH_SHORT).show(); | |
| Looper.loop(); | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment