CookieSyncManager.createInstance(getActivity());
CookieManager cookieManager = CookieManager.getInstance();
if(Build.VERSION.SDK_INT>=21){
cookieManager.setAcceptThirdPartyCookies(webView, true);
}
cookieManager.removeSessionCookie();//移除
// cookieManager.removeAllCookie();
cookieManager.setAcceptCookie(true);
cookieManager.setCookie(url, "MTGK=TGK-26877-E2MESgKXPyCFaXisrPdd2hwzhzIrmwJcFgb");//cookies是在HttpClient中获得的cookie
cookieManager.setCookie(url, "Domain=.mogujie.org");//cookies是在HttpClient中获得的cookie
cookieManager.setCookie(url, "Path= /");//cookies是在HttpClient中获得的cookie
CookieSyncManager.getInstance().sync();