替AsyncHttpClient设置Cookie

为AsyncHttpClient设置Cookie 
使用AsyncHttpClient向服务端提交数据,有时需要带cookie。给AsyncHttpClient设置Cookie的方法如下: 

AsyncHttpClient myClient = new AsyncHttpClient(); 

PersistentCookieStore myCookieStore = new PersistentCookieStore(this); 
BasicClientCookie newCookie = new BasicClientCookie("name1", "value1"); 
newCookie.setVersion(1); 
newCookie.setDomain("mydomain.com"); 
newCookie.setPath("/"); 
myCookieStore.addCookie(newCookie); 

myClient.setCookieStore(myCookieStore); 

client.post(url, params, new AsyncHttpResponseHandler(){}); 


参考: 
http://loopj.com/android-async-http 

http://loopj.com/android-async-http/doc/com/loopj/android/http/AsyncHttpClient.html

你可能感兴趣的:(替AsyncHttpClient设置Cookie)