안드로이드 개발 질문/답변
(글 수 45,052)
Url로 이용하여서 Tomcat Server xml 불러오기 하려구 하는데요..
public class CallXml extends Activity {
private TextView tv;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
tv = (TextView) findViewById(R.id.asdf);
try
{
try {
URL url = new URL("http://xxx.xxx.x.xx:7070/test1/testlist.xml");
//xxx.xxx.x.xx에는 아이피가 들어갑니다.
try {
BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
String htmlText;
while((htmlText = br.readLine()) != null){
tv.setText(htmlText);
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}catch(Exception e)
{
tv.setText("Error: "+e.getMessage());
}
setContentView(tv);
}
}
이와 같이 코드가 되어있습니다..
근대요 ㅠㅜ 안드로이드에서 톰캣 서버에있는 xml 파일을 불러올수는 없는것인가요??
Image Error.bmp
안드로이드에서 뜨고있는 에러
xml.bmp
톰켓 서버 xml의 위치
물론 톰켓 서버는 켜져있기때문에 익스플로러나 파이어폭스로 같은주소에서 치면 들어가집니다 . ㅠㅜ
고수님들의 조언이 필요합니다. 읽어주셔서 감사합니다.
public class CallXml extends Activity {
private TextView tv;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
tv = (TextView) findViewById(R.id.asdf);
try
{
try {
URL url = new URL("http://xxx.xxx.x.xx:7070/test1/testlist.xml");
//xxx.xxx.x.xx에는 아이피가 들어갑니다.
try {
BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
String htmlText;
while((htmlText = br.readLine()) != null){
tv.setText(htmlText);
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}catch(Exception e)
{
tv.setText("Error: "+e.getMessage());
}
setContentView(tv);
}
}
이와 같이 코드가 되어있습니다..
근대요 ㅠㅜ 안드로이드에서 톰캣 서버에있는 xml 파일을 불러올수는 없는것인가요??
Image Error.bmp
안드로이드에서 뜨고있는 에러
xml.bmp
톰켓 서버 xml의 위치
물론 톰켓 서버는 켜져있기때문에 익스플로러나 파이어폭스로 같은주소에서 치면 들어가집니다 . ㅠㅜ
고수님들의 조언이 필요합니다. 읽어주셔서 감사합니다.
while((htmlText = br.readLine()) != null){
tv.setText(htmlText);
}
이부분에서 tv.setText를 계속 여러번
하게되는부분에서 오류가 생긴거같습니다.