您的位置:首页 > 移动开发 > Android开发

xutils保存cookie

2015-09-06 10:30 309 查看
public class XUtilsHelper {
private static HttpUtils client;
public static PreferencesCookieStore cookieStore;
/**
* 单例模式获取实例对象
*
* @param context
* 应用程序上下文
* @return HttpUtils对象实例
*/
public static HttpUtils getInstence(Context context) {
if (client == null) {
// 设置请求超时时间为20秒
client = new HttpUtils(2000 * 10);
client.configSoTimeout(2000 * 10);
client.configResponseTextCharset("UTF-8");
cookieStore = new PreferencesCookieStore(context);
// LogUtils.e("cookie--->"+cookieStore.getCookies().toString());
// cookieStore.clear(); // 清除原来的cookie
client.configCookieStore(cookieStore);
}
return client;
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  Android xutils cookie