final SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(mContext);
final OkHttpClient okHttpClient = new OkHttpClient.Builder()
.addInterceptor(new Interceptor() {
@Override
public okhttp3.Response intercept(Interceptor.Chain chain) throws IOException {
Request.Builder ongoing = chain.request().newBuilder();
ongoing.addHeader("Cache-Control", "no-cache");
ongoing.addHeader("User-Agent", System.getProperty("http.agent"));
ongoing.addHeader("authorization", sharedPreferences.getString("api_key",""));
return chain.proceed(ongoing.build());
}
})
.build();
new Picasso.Builder(mContext).downloader(new OkHttp3Downloader(okHttpClient)).build().with(mContext).load(event.getPictureUrl()).into(holder.eventimage);
我正在使用
com.squareup.picasso:picasso:2.5.2
,com.jakewharton.picasso:picasso2-okhttp3-downloader:1.1.0
,com.squareup.okhttp3:okhttp:3.4.1
它不会在标题中发送任何内容。如何解决这个问题?
一旦我添加了这个Picasso.setSingletonInstance(picasso);后来我用Picasso工作了。
答案 0 :(得分:0)
试试这个。
v3