JSoup Android Studio崩溃
我想使用JSoup获取一个Spans值,我没有错误,但我的应用程序只是打开和关闭。如果我不使用,试着抓住JSoup Android Studio崩溃,android,android-studio,jsoup,Android,Android Studio,Jsoup,我想使用JSoup获取一个Spans值,我没有错误,但我的应用程序只是打开和关闭。如果我不使用,试着抓住 JSoup.connect(url).get() 有如下问题: “未处理的异常java.io.IOException” 请试试这个 //add Exception to method signature protected void onCreate(Bundle savedInstanceState) throws IOException { super.onCreate(savedIn
JSoup.connect(url).get()
有如下问题:
“未处理的异常java.io.IOException”
请试试这个
//add Exception to method signature
protected void onCreate(Bundle savedInstanceState) throws IOException {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//don't forget to set timeOut like this
Document doc = Jsoup.connect(url)timeOut(0).get();
title = doc.title();
//Element span = doc.getElementsByClass("jfg-badge badge-count").get(0);
TextView titleText = (TextView) findViewById(R.id.titletext);
titleText.setText(title);
}
}
//add Exception to method signature
protected void onCreate(Bundle savedInstanceState) throws IOException {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//don't forget to set timeOut like this
Document doc = Jsoup.connect(url)timeOut(0).get();
title = doc.title();
//Element span = doc.getElementsByClass("jfg-badge badge-count").get(0);
TextView titleText = (TextView) findViewById(R.id.titletext);
titleText.setText(title);
}
}