-2
HttpResponse response = httpclient.execute(httppost);
BufferedReader reader = new BufferedReader(new InputStreamReader(is
HttpResponse response = httpclient.execute(httppost);
BufferedReader reader = new BufferedReader(new InputStreamReader(is
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder()。permitAll()。build(); StrictMode.setThreadPolicy(policy);
try
{
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://127.0.0.1:8080/list.php");
HttpResponse response = httpclient.execute(httppost);
HttpEntity entity = response.getEntity();
is = entity.getContent();
}catch(Exception e)
{
System.out.println("Exception 1");
}
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(is , "iso-8859-1"),20);
StringBuilder sb = new StringBuilder();
while ((line = reader.readLine())!=null)
sb.append(line +"\n");
result = sb.toString();
is.close();
System.out.println("----------------Here Is My Data-------------------");
System.out.println(result);
} catch (Exception e)
{
System.out.println("Exception 2");
}
this is code but buffered reader stay empty
請修改您的問題,而不是發佈這個答案 –
您的代碼不完整。你有任何錯誤?你有什麼試圖理解這個問題? – Duston
這是部分程序,但在HttpResponse響應= httpclient.execute(httppost)後到達程序;將停止 –