retrofit 返回string

来源:互联网 发布:中国贫富差距数据 编辑:程序博客网 时间:2024/05/19 19:14

先声明一下我这里使用的 Retrofit 的版本是

compile 'com.squareup.retrofit:retrofit:2.0.0-beta1'compile 'com.squareup.retrofit:converter-gson:2.0.0-beta1'
其他版本不一定可以这么使用

Retrofit retrofit = new Retrofit.Builder()        .baseUrl(baseUrl)        .client(okHttpClient)        .addConverter(String.class,new ToStringConverter())        .addConverterFactory(GsonConverterFactory.create())        .build();

这里我得自定义这个 ToStringConverter 实现 Converter类



我这里就不介绍retrofit 的基本使用方式了 网上一搜一大片


0 0