我想在执行 HTTPGET 请求的不同活动中使用存储在列表中的 cookie。(使其成为全局或持久)
我存储 cookie 的代码是:
HttpResponse sessionresp = httpclient.execute(httppost);
List<Cookie> cookielist=httpclient.getCookieStore().getCookies();
for (int i = 0; i < cookielist.size(); i++) {
Cookie cookie1 = cookielist.get(i);
Log.i("Cookie Store","Local cookie: " + cookie1);
//Cookie mSessionCookie = cookie1;
Log.i("Cookie Store",""+cookie1.getValue());
cookieStore.addCookie(cookie1);
httpclient2.setCookieStore(cookieStore);
}
我想在执行 HTTP GET 操作的不同活动中使用这些 cookie。任何输入?