开发者

Android reading cookies

开发者 https://www.devze.com 2023-03-02 09:59 出处:网络
Hey, how can I read a value of a cookie? Example: String cs = CookieManager.getInstance().getCookie(); System.out.println(\"Cookies 开发者_运维技巧string:\"+cs);

Hey, how can I read a value of a cookie?

Example:

String cs = CookieManager.getInstance().getCookie();
System.out.println("Cookies 开发者_运维技巧string:  "+cs);

This will give me a string which has to be parsed with split on ';' and '='. Is there a "cookie string reader" or smth? Is there any other way of reading the value of only one particular cookie in the webview?

Thx!


Well, I suggest that you parse the string into an Array yourself. That would then be something along these lines in standard Java:

String[] x = Pattern.compile(";").split(CookieManager.getInstance().getCookie());

Now you have an Array of name - value pairs, which you can further parse and then store.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号