cookie 总是返回 null...
在 android 2.x 这很好用,但 4.0.4 ICS 不工作
ConnectivityManager manager = (ConnectivityManager) mContext
.getSystemService(Context.CONNECTIVITY_SERVICE);
CookieManager cookie = CookieManager.getInstance();
if(cookie.getCookie(mContext.getString(R.string.host_url))!=null){
conn.setRequestProperty("Cookie", cookie.getCookie(mContext.getString(R.string.host_url)));
Log.d("tag", "cookie get " + cookie.getCookie(mContext.getString(R.string.host_url)));
}
在这段代码中 cookie.getCookie() 总是返回 null ...
*在 HttpUrlConnection 中使用此代码