I've found this topic for PostData using http. but it doesn't work.
What's wrong?
I also requested Android.permission.INTERNET
in the manifest
.
public void postData() {
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http:/mysite.com/postTest.php");
try {
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(1);
nameValuePairs.add(new BasicNameValuePair("pw", "12456"));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
// Execute HTTP Post Request
HttpResponse response = httpclient.execute(httppost);
tv.setText(response.toString());
} catch (ClientProtocolException e) {
//
} catch (IOException e) {
//
}
}
Edit
My application will be terminated with this message :
Unfortunately PostDataProject has stopped.