i want to send a simple data from android device to asp.net page using post method..
but i didn’t know how to request a web page from android!!!
asp page is good and can response a data without any errors..
but the problem in android application…
now i’m using this code but it didn’t work
public void postData() throws ClientProtocolException, IOException, Exception {
String key = "https://www.itrack.somee.com/post.aspx?id=10&long=123&lat=123&alt=123";
//URI uri=new URI(key);
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost(key);
Toast.makeText(this, "here", Toast.LENGTH_LONG).show();
HttpResponse response = httpclient.execute(httppost);
Toast.makeText(this,"mm"+response.toString(), Toast.LENGTH_LONG).show();
}
any help…..!!
You can create an
ArrayListofnameValuePairsand attach them to an HttpPost with thesetEntitymethod.