我尝试将网站的动态某些内容加载到 webview 中,但我不能使用此代码`public class MainActivity extends Activity {
// blog url
static final String BLOG_URL = "http://www.internationalnewscenter.com/";
@Override
public void onCreate(Bundle savedInstanceState) {
// set layout view
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// process
try {
((TextView)findViewById(R.id.textView1)).setText(getBlogStats());
} catch (Exception ex) {
((TextView)findViewById(R.id.textView1)).setText("Error");
}
}
protected String getBlogStats() throws Exception {
String result = "";
// get html document structure
Document document = Jsoup.connect(BLOG_URL).get();
// selector query
Elements nodeBlogStats = document.select("div#lofslidecontent45");
// check results
if(nodeBlogStats.size() > 0) {
// get value
result = nodeBlogStats.get(0).text();
}
// return
return result;
}
但它为我显示一个“错误”`是任何人都可以帮助我或给我一个完整示例的链接来做到这一点