意思大体是,你的adapter的内容变化了,但是你的ListView并不知情。请保证你adapter的数据在主线程中进行更改!
public class OrderAdapter extends BaseAdapter {
private ArrayList<Map<String, Object>> lists;
private Context context;
private Handler handler;
private BranchIdCallBack branchIdCallBack;
public OrderAdapter(ArrayList<Map<String, Object>> list, Context context, Handler handler) {
super();
this.lists = list;
this.context = context;
this.handler = handler;
}
@SuppressWarnings("unchecked")
public void setDeviceList(ArrayList<Map<String, Object>> list) {
if (list != null) {
lists = (ArrayList<Map<String, Object>>)list.clone();
notifyDataSetChanged();
}
}
public void clearDeviceList() {
if (lists != null) {
lists.clear();
}
notifyDataSetChanged();
}
@Override
public int getCount() {
return lists==null?0:lists.size();
}
adapter数据发生变化要及时刷新。