第12月第8天 Retrofit.builder

1.

        retrofit = new Retrofit.Builder()
                .client(okHttpClient)
                .addConverterFactory(GsonConverterFactory.create(gson))
                .addCallAdapterFactory(RxJavaCallAdapterFactory.create())
                .baseUrl("http://gank.io/api/")
                .build();
        service = retrofit.create(ApiService.class);

 

new HttpBuilder("url")
                .params(map)
                .params("key","value")
                .tag(this)//需要取消请求的tag
                .success(str->{
                    //do something surccess
                })
                .error(v->{
                    //deal something error
                })
                .get();

 

 

http://blog.csdn.net/gengqiquan/article/details/52329259

 

https://github.com/gengqiquan/HttpUtil

 

posted @ 2017-09-08 10:50  lianhuaren  阅读(155)  评论(0编辑  收藏  举报