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.