i'am new to ANDROID. I have to send some data from my and开发者_如何学Pythonroid app to a local server and retrieve some information. How can i do that??? Please help me
public void executeHttpPost(String string) throws Exception
{
//This method for HttpConnection
try
{
HttpClient client = new DefaultHttpClient();
HttpPost request = new HttpPost("url");
List<NameValuePair> value=new ArrayList<NameValuePair>();
value.add(new BasicNameValuePair("name",string));
System.out.println("Json obj="+string);
UrlEncodedFormEntity entity=new UrlEncodedFormEntity(value);
request.setEntity(entity);
client.execute(request);
System.out.println("after sending :"+request.toString());
}
catch(Exception e) {System.out.println("Exp="+e);
}
}
精彩评论