rxjava android 怎么同时发两个请求
1个回答
展开全部
erride
public void getPlaceAndWeatherData(String place) {
mMainView.showProgress();
PlaceRepository repository = new PlaceRepository();
Context context = BaseApplication.getInstance();
Observable placeObservable = repository.getPlaceList(context);
Observable weatherObservable = ServiceManager.getInstance().getApiService().getWeatherInfo(place, Constants.BAIDU_AK);
Observable.merge(placeObservable, weatherObservable)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Subscriber<Object>() {
@Override
public void onCompleted() {
mMainView.hideProgress();
}
@Override
public void onError(Throwable e) {
public void getPlaceAndWeatherData(String place) {
mMainView.showProgress();
PlaceRepository repository = new PlaceRepository();
Context context = BaseApplication.getInstance();
Observable placeObservable = repository.getPlaceList(context);
Observable weatherObservable = ServiceManager.getInstance().getApiService().getWeatherInfo(place, Constants.BAIDU_AK);
Observable.merge(placeObservable, weatherObservable)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Subscriber<Object>() {
@Override
public void onCompleted() {
mMainView.hideProgress();
}
@Override
public void onError(Throwable e) {
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询