Android的阅读饼干 [英] Android reading cookies
本文介绍了Android的阅读饼干的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
咦,我怎么可以读取一个cookie的值?
Hey, how can I read a value of a cookie?
例如:
String cs = CookieManager.getInstance().getCookie();
System.out.println("Cookies string: "+cs);
这将使我有与分裂的解析字符串;及=。是否有一个cookie字符串读者还是不服?是否有读入的WebView只在某个特定的cookie的值,任何其他方式?
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!
推荐答案
那么,我建议你解析字符串转换成自己的数组。那么这将是沿着标准的Java这些方针的东西:
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.
这篇关于Android的阅读饼干的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文