webview获取cookie

在WebViewClient里复写onPageFinished方法

public void onPageFinished(WebView view, String url) {
    CookieManager cookieManager = CookieManager.getInstance();
    String CookieStr = cookieManager.getCookie(url);
    Common.cookie = CookieStr;
    Toast.makeText(activity,CookieStr,Toast.LENGTH\_SHORT).show();
    super.onPageFinished(view, url);
}

你可能感兴趣的:(android,webview)