package com.parse;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.List;
import net.htmlparser.jericho.Element;
import net.htmlparser.jericho.HTMLElementName;
import net.htmlparser.jericho.Source;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
import android.widget.Toast;
public class JerichoActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
String yourUrl = "http://job.konkuk.ac.kr/data/data_list.asp?type=form";
TextView tv = (TextView)findViewById(R.id.mainTextView);
tv.setText(getHtmltoText(yourUrl));
}
public String getHtmltoText(String UrlString)
{
Source source = null;
//String content = null;
String href = "바보";
String label = null;
String list = null;
String li = null;
try{
source = new Source(new URL("UrlString);
source.fullSequentialParse();
//content = source.getTextExtractor().toString(); //문자열만 뽑아오는 함수
//content = new String(content.getBytes(source.getEncoding()),"EUC-KR"); //인코딩 타입 설정
List<Element> atags = source.getAllElements(HTMLElementName.TD);
Toast.makeText(JerichoActivity.this, "파싱을 시작합니다.", Toast.LENGTH_SHORT).show();
for(int i=0; i < atags.size(); i++)
{
Element e = (Element) atags.get(i);
href = e.getAttributeValue("class");
label = e.getContent().getTextExtractor().toString();
if(href.equals("board_con")) 오류나는 부분입니다!!!!!!!!!!!!!!!!!!!!!!!!!!!
{
list += href + "!!!!!" +label;
}
}
Toast.makeText(JerichoActivity.this, "파싱이 종료되었습니다.", Toast.LENGTH_SHORT).show();
}catch(MalformedURLException e) {
e.printStackTrace();
}
catch(IOException e) {
e.printStackTrace();
}
return list;
}
}
대체왜 오류인지 모르겠어요ㅠㅠ
ActivityThread.performLaunchActivity(ActivityThread$ActivityCientRecord, Intent) 오류가 났어요 ㅠㅠ




if(href.equals("board_con"))
여기가 오류났다면 href가 null pointer exception 냈을 가능성밖에 상상이 안가네요.
android는 onCreate 과정에서 exception이 발생하면
ActivityThread.performLaunchActivity(ActivityThread$ActivityCientRecord, Intent) 이 로그를 찍고 죽죠
onCreate에서 일반 로직을 처리하는건 좋은 버릇이 아닙니다.
activity 에서 사용하는 view / data를 초기화 하는 작업만 하세요