14

この OkHttpStack は、OkHttp2.0 ではサポートされなくなりました: https://gist.github.com/JakeWharton/5616899

OkHttp 2.0.0 を Volley と統合する現在のパターンは何ですか?

4

3 に答える 3

5

これも使えます

import com.android.volley.toolbox.HurlStack;
import com.squareup.okhttp.OkHttpClient;
import com.squareup.okhttp.OkUrlFactory;

/**
 * An {@link com.android.volley.toolbox.HttpStack HttpStack} implementation
 * which uses OkHttp as its transport.
 */
public class OkHttpStack extends HurlStack {
    private final OkUrlFactory mFactory;

    public OkHttpStack() {
        this(new OkHttpClient());
    }

    public OkHttpStack(OkHttpClient client) {
        if (client == null) {
            throw new NullPointerException("Client must not be null.");
        }
        mFactory = new OkUrlFactory(client);
    }
}
于 2014-07-25T08:56:52.680 に答える