Monday, May 14, 2012

managing Cookies in HttpPost

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;

public void onCreate() {
// TODO Auto-generated method stub
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;

MyApplication app = (MyApplication) mContext

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