我有一个 CustomBaseAdapter 用于填充某些字段:
public ArrayList<SearchResults> GetSearchResults(){
ArrayList<SearchResults> results = new ArrayList<SearchResults>();
Document doc = Jsoup.parse(kpn);
Elements tdsFromSecondColumn = doc.select("table.personaltable td:eq(0)");
Elements tdsFromSecondColumn1 = doc.select("table.personaltable td:eq(1)");
SearchResults sr1 = new SearchResults();
for (Element tdFromSecondColumn : tdsFromSecondColumn) {
sr1 = new SearchResults();
sr1.setNaam(tdFromSecondColumn.text());
results.add(sr1);
}
for (Element tdFromSecondColumn1 : tdsFromSecondColumn1) {
sr1 = new SearchResults();
sr1.setWaarde(tdFromSecondColumn1.text());
results.add(sr1);
}
return results;
}
我想启动 AsyncTask 的 onPostExecute ,但我强制关闭:
@Override
protected void onPostExecute(String result) {
ListView kp = (ListView)findViewById(R.id.kpn);
ArrayList<SearchResults> searchResults = GetSearchResult();
kp.setAdapter(new MyCustomBaseAdapter(this, searchResults)); <--- think here is the error
progress.dismiss();
}
这段代码可能吗?如果没有应该改变什么。先感谢您。