所以我在下面的屏幕截圖中有這段代碼導致了類型IOExceptions。Try-Catch Statement Trouble
http://southwestdesign.org.uk/Code.jpg
有人告訴我,我需要將其包裝在一個try-catch塊,每個包裝塊invididual一個嘗試捕捉消除了錯誤,但力在Android上關閉。有人能指點我正確的方向嗎?
@Override
public void onStart() {
HttpClient client = new DefaultHttpClient();
HttpGet request = new HttpGet("http://1.php");
HttpResponse response = client.execute(request);
BufferedReader rd = new BufferedReader
(new InputStreamReader(response.getEntity().getContent()));
TextView textView = (TextView) findViewById(R.id.TextView1);
String line = "";
while ((line = rd.readLine()) != null) {
textView.append(line);
}
}
謝謝你們。
你應該讀一些關於java的基本知識。我建議用java思考 – Blackbelt
你甚至應該在任何其他事情之前谷歌。 – Siddharth
我同意,SO應該是您的最後手段 – chrislhardin