안드로이드 개발 질문/답변
(글 수 45,052)
public class parsertest extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
TextView text = (TextView)findViewById(R.id.htmltext);
URL url = null;
//URL객체를 생성하고 해당 URL로 접속한다..
try{
url = new URL("http://www.ajou.ac.kr/campus_life/food/today.jsp");
HttpURLConnection conn = (HttpURLConnection)url.openConnection();
InputStream is;
InputStreamReader isr;
BufferedReader br;
String content=new String();
String buf = null;
is = conn.getInputStream();
isr = new InputStreamReader(is);
br = new BufferedReader(isr);
//내용을 읽어서 화면에 출력한다..
while(true){
buf = br.readLine();
System.out.println(buf);
if(buf == null) break;
else content += buf+"\n";
}
HtmlCleaner cleaner=new HtmlCleaner();
CleanerProperties props=cleaner.getProperties();
TagNode node=null;
try {
node=cleaner.clean(buf);
}catch (IOException e) {
e.printStackTrace();
}
SimpleXmlSerializer se=new SimpleXmlSerializer(props);
try {
se.writeXmlToStream(node, System.out);
} catch (IOException e) {
e.printStackTrace();
}
}catch (MalformedURLException e) {
e.printStackTrace();
}catch (IOException e){
e.printStackTrace();
}
}
}
웹에서 정보를 받아와서 안드로이드 화면에 뿌려줄려고하는데..(단순히 html소스자체가 나타나는게 아니라 파싱된화면,)
도통 나타날 생각을 안하네요..어디를 손봐야할까요? 무작정 덤비다보니 힘드네요




View 같은 객체를 생성하셔서 그 쪽으로 출력을 하세요..