use of com.lzy.demo.callback.StringDialogCallback in project okhttp-OkGo by jeasonlzy.
the class CookieActivity method addCookie.
@OnClick(R.id.addCookie)
public void addCookie(View view) {
HttpUrl httpUrl = HttpUrl.parse(Urls.URL_METHOD);
Cookie.Builder builder = new Cookie.Builder();
Cookie cookie = builder.name("myCookieKey1").value("myCookieValue1").domain(httpUrl.host()).build();
CookieStore cookieStore = OkGo.getInstance().getCookieJar().getCookieStore();
cookieStore.saveCookie(httpUrl, cookie);
showToast("详细添加cookie的代码,请看demo的代码");
//
OkGo.post(Urls.URL_TEXT_UPLOAD).tag(//
this).execute(new StringDialogCallback(this) {
@Override
public void onSuccess(String s, Call call, Response response) {
handleResponse(s, call, response);
}
@Override
public void onError(Call call, Response response, Exception e) {
super.onError(call, response, e);
handleError(call, response);
}
});
}
Aggregations