初次使用RxAndroid + Retrofit

2016-06-28  本文已影响0人  南柯好萌
Retrofit retrofit = new Retrofit.Builder()        .baseUrl("http://lily.tvxio.com/")        .addConverterFactory(GsonConverterFactory.create())        .addCallAdapterFactory(RxJavaCallAdapterFactory.create())        .client(HttpManager.getInstance().mClient)        .build();HttpAPI.IpLookup ipLookup = retrofit.create(HttpAPI.IpLookup.class);ipLookup.doRequest(SimpleRestClient.device_token).subscribe(new Subscriber<IpLookUpEntity>() {    @Override    public void onCompleted() {        Log.i(TAG, "fetchLocation: onCompleted");    }    @Override    public void onError(Throwable e) {        Log.e(TAG, "fetchLocation: error");    }    @Override    public void onNext(IpLookUpEntity ipLookUpEntity) {        initializeLocation(ipLookUpEntity);    }});
上一篇 下一篇

猜你喜欢

热点阅读