https://github.com/Zaylour/AndRoid_CRUD/tree/master/ZyMvp
你的Adapter初始化的时候是在onResume里执行的,并没有更新界面,需要notifyDataSetChanged()触发更新界面
////刷新listview
public void refreshView(){
all = cp.findAll();
Log.e("ceshi","刷新方法");
if(listAdapter==null){
listAdapter=new ListAdapter(this,all);
v.setAdapter(listAdapter);
listAdapter.notifyDataSetChanged();//检测到变化
}else{
listAdapter.students.clear();//清空适配器的list
listAdapter.students.addAll(all);//重新赋值
listAdapter.notifyDataSetChanged();//检测到变化
}
}
adapter.notifyDataSetChanged();
建议用中转变量接收更新的数据,再调用adapter.notifyDataSetChanged();