ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
nameValuePairs.add(new BasicNameValuePair(
"product_name", product_name));
nameValuePairs.add(new BasicNameValuePair("brand",
brand_product));
nameValuePairs.add(new BasicNameValuePair("reference_price",
mrp_product));
nameValuePairs.add(new BasicNameValuePair("model",
model_product));
HttpPost httppost = new HttpPost(
"http://10.0.2.2/wic3/wic2/product/doadd");
httppost.setEntity(new UrlEncodedFormEntity(
nameValuePairs));
ResponseHandler<String> responseHandler = new BasicResponseHandler();
String response = SignUpActivity.httpclient.execute(
httppost, responseHandler);
Log.d("response", response);
Intent intent = new Intent(ShareProductActivity.this, ShareActivity.class);
startActivity(intent);
this gives me an exception:
05-07 14:56:19.105: D/exception(1137): org.apache.http.conn.HttpHostConnectException: Connection to http://localhost refused
i searched for this and everyone says change 127.0.0.1
to 10.0.2.2
, but i am not using 127.0.0.1
I guess the problem is at this step:
String response = SignUpActivity.httpclient.execute(httppost, responseHandler);