的风险,请在"try CATCH"中试试这段代码。
此代码可在BlueStacks中工作,但当智能手机运行时在日志中显示以下错误。
错误:The content of the adapter has changed but ListView did not receive a
notification. Make sure the content of your adapter is not modified from a
background thread, but only from the UI thread. Make sure your adapter calls
notifyDataSetChanged() when its content changes. [in ListView(2131296334, class
android.widget.ListView) with Adapter(class android.widget.HeaderViewListAdapter)]
代码:private void displayResultList() {
try {
array.clear();
array=baseHelper.results;
tView.setText("Size : " +array.size()+" "+ baseHelper.countmcur );
try {
if(arrayAdapter!=null)
arrayAdapter.notifyDataSetChanged();
arrayAdapter=new display();
listV.setAdapter(arrayAdapter);
arrayAdapter.notifyDataSetChanged();
} catch (Exception e) {
message.messages(contex, e.getMessage());
}
listV.setTextFilterEnabled(true);
} catch (Exception e) {
message.messages(contex, e.getMessage());
}
}
在您从适配器更改数据后,您应该调用notifydatachchange。接下来,调试代码以找出哪一列出现错误。除此之外,如果有出现错误