2011. 5. 16. 14:44
Webview content = new Webview(this);
String data="<html>"+
"<head>"+
"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">"+
"</head>"+
"<body>"+
"<div style=\"text-align:left\">"
+"글로벌 금융위기 전후 4년간 한국인의20% 실질 재산이 6분의 1이나 감소한 것으 "
+"</div>"+
"</body>"+
"</html>";
content.loadData(data,"text/html;charset=UTF-8","UTF-8");
위와같이 할시 페이지를 찾을 수 없습니다가 나올 것이다...
이유는... %때문에.. 이것을 html 특수문자표에서 해당 특수기호와 동일한 특수문자를 replace 시켜야한다.
String tuning = data;
tuning = tuning.replaceAll("%", "%");
tuning = tuning.replaceAll("\n", "<br>");
위와같이 replaceAll을 이용해서 바꾸어주면 정상적으로 나올것이다...
String data="<html>"+
"<head>"+
"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">"+
"</head>"+
"<body>"+
"<div style=\"text-align:left\">"
+"글로벌 금융위기 전후 4년간 한국인의20% 실질 재산이 6분의 1이나 감소한 것으 "
+"</div>"+
"</body>"+
"</html>";
content.loadData(data,"text/html;charset=UTF-8","UTF-8");
위와같이 할시 페이지를 찾을 수 없습니다가 나올 것이다...
이유는... %때문에.. 이것을 html 특수문자표에서 해당 특수기호와 동일한 특수문자를 replace 시켜야한다.
String tuning = data;
tuning = tuning.replaceAll("%", "%");
tuning = tuning.replaceAll("\n", "<br>");
위와같이 replaceAll을 이용해서 바꾸어주면 정상적으로 나올것이다...
'Programming > Android' 카테고리의 다른 글
Android - 리소스 xml coding시 단위 (0) | 2011.05.25 |
---|---|
Android - Create Option (0) | 2011.05.19 |
Android - sdcard에 있는 textfile읽을때 문자가 깨질시 (0) | 2011.05.16 |
Android - Activity간 데이터 주고 받기 (0) | 2011.05.13 |
Android - read textfile in sdcard (0) | 2011.05.13 |