我使用 http 找到了 PostData这个主题。但它不起作用。
怎么了?
我也在Android.permission.INTERNET
.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) {
//
}
}
编辑
我的应用程序将被此消息终止:
Unfortunately PostDataProject has stopped.