For using Cookie store In Application and
public class MyApplication extends Application {
public String cookie = null;
private static HttpURLConnection conn = null;
public static CookieStore cookieStore;
public static HttpContext localContext;
@Override
public void onCreate() {
// TODO Auto-generated method stub
super.onCreate();
CookieSyncManager.createInstance(this);
cookie = null;
cookieStore = new BasicCookieStore();
localContext = new BasicHttpContext();
}
public HttpURLConnection getSingleConnection(){
return conn;
}
}
Using cookies In my multipart Requset Runnable
DefaultHttpClient client = new DefaultHttpClient();
HttpPost post = new HttpPost(requestUrl);
HttpResponse resp;
post.setEntity(reqEntity);
MyApplication app = (MyApplication) mContext
.getApplicationContext();
try {
resp = client.execute(post,app.localContext);
but i can`t managing it.
i see How do I manage cookies with HttpClient in Android and/or Java?
this page but i can`t handle it...
is there problem in my code?
No comments:
Post a Comment