我没有得到任何回复,我的代码中有什么问题。由于隐私政策,我没有提供正确的URl。
public static String URL = "http://www.example.com/web_service/mainAPI.php";
final String body = String.format("rquest={\"method\":\"upcoming_shows\",\"body\":[{}]}");
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.upcoming_show);
try{
Log.d("In Try", "Going...");
final HttpClient client = new DefaultHttpClient();
final HttpPost postMethod = new HttpPost(URL);
postMethod.setEntity(new StringEntity(body, "utf-8"));
final HttpResponse response = client.execute(postMethod);
final String responseData = EntityUtils.toString(response.getEntity(), "utf-8");
Toast.makeText(UpcomingShow.this, responseData, Toast.LENGTH_SHORT).show();
}catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
请给我一些解决方案。