我想删除所有文本列表信息,但不知道在哪里注册命令 listview.clear
btnclear.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
DeleteDataBaseDialog deleteDatabase = new DeleteDataBaseDialog();
deleteDatabase.show(getSupportFragmentManager(), "delete database");
ListView.clear;
}
});
答案 0 :(得分:0)
在清除arrayadapter列表后,您需要通知listview的适配器其数据集已更改。
list.clear();
//Btw, if you're using ArrayAdapter, you could also use it's clear method
//listview.getAdapter().clear();
listview.getAdapter().notifyDataSetChanged();