如何在android改造中传递参数的值

时间:2018-11-13 11:41:10

标签: java android retrofit retrofit2

有关“改装”的问题

我有一个类似listing/get_listings?listing_type=featured的api 在此api中,我有一个参数listing_type ...我正在这样使用它

@GET("listing/get_listings")
    Call<List<ProviderModel>> getProviderListing(@Query("listing_type") String listing_type);

现在我要添加这样的参数值:

 RetrofitUtil.createProviderAPI().getProviderListing("featured").enqueue(getProviders(this));

但是我没有得到回应,谁能帮助我解决问题

1 个答案:

答案 0 :(得分:0)

添加登录接受器并检查问题

implementation 'com.squareup.okhttp3:logging-interceptor:3.3.1'


 okhttp3.OkHttpClient.Builder client = new okhttp3.OkHttpClient.Builder();
    HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor();
    loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY);


    client.addInterceptor(loggingInterceptor);


    Retrofit retrofit = new Retrofit.Builder().baseUrl(OfflineApi.base_url).client(client.build()).addConverterFactory(GsonConverterFactory.create()).build();