如何解决如何在排球上使用脚蹼?
我想在我的截击网络呼叫中增加对翻转器的支持,因为某些旧式呼叫仍是用截击编写的。我正在尝试实施this solution,但无法使其正常工作。
OkHttpStack类-
public class OkHttpStackApi extends HurlStack {
private final OkHttpClient client;
public OkHttpStackApi() {
this(new OkHttpClient());
}
public OkHttpStackApi(OkHttpClient client) {
if (client == null) {
throw new NullPointerException("Client must not be null.");
}
this.client = client;
}
@Override
protected HttpURLConnection createConnection(URL url) throws IOException {
return new OkUrlFactory(client).open(url);
}
}
CustomVolleyRequestQueue-
public class CustomVolleyRequestQueue {
private static CustomVolleyRequestQueue mInstance;
private static Context mCtx;
private RequestQueue mRequestQueue;
private CustomVolleyRequestQueue(Context context) {
mCtx = context;
mRequestQueue = getRequestQueue();
}
public static synchronized CustomVolleyRequestQueue getInstance(Context context) {
if (mInstance == null) {
mInstance = new CustomVolleyRequestQueue(context);
}
return mInstance;
}
public RequestQueue getRequestQueue() {
if (mRequestQueue == null) {
mRequestQueue = Volley.newRequestQueue(mCtx,new OkHttpStackApi());
// Don't forget to start the volley request queue
mRequestQueue.start();
}
return mRequestQueue;
}
}
我一直无法解决任何问题,因为我一直在使用Retrofit,并且能够轻松地为其添加支持。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。