String DownloadHtml(String addr){
StringBuilder html = new StringBuilder();
TextView debug = (TextView)findViewById(R.id.debugtext);
try{
URL url = new URL("addr);
HttpURLConnection conn = (HttpURLConnection)url.openConnection();
if(conn != null) {
list.add("Connection Successful");
conn.setConnectTimeout(10000);
conn.setUseCaches(false);
if(conn.getResponseCode() == HttpURLConnection.HTTP_OK){
list.add("HttpURLConnection Successful");
BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream(), "euc-kr"));
while(true){
String line = br.readLine();
if(line == null) {
break;
}
html.append(line+"n");
}
br.close();
} else {
list.add("HttpURLConnection Failed");
}
conn.disconnect();
} else {
list.add("Connection Failed");
}
} catch(Exception ex) {
;
}
return html.toString();
}
이 함수에서 문제가 발생하는것 같습니다.
진저브레드에선 Connection Successful - HtmlURLConnection Successful - 이후 내용 읽기 순으로 잘 됩니다만,
ICS에선 Connection Successful 이후로 반응이 없습니다. 심지어 if ~~ else ~~ 문으로 코드를 짰는데도 Successful이나 Failed 어느 쪽의 메세지도 나오지 않습니다.
list는 디버그 메세지 출력용 ListView입니다.
어떻게 변경해야될까요?
Strict Mode에 대해 알아보세요