[英]notifyDataSetChanged() doesn't update ListView
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_OK) {
deserializeQuotes();
quotesAdapter.notifyDataSetChanged();
}
}
My array clearly has been updated, and I can see the change when my app starts, but why doesn't it update in this method? 我的数组显然已经更新,并且我的应用启动时可以看到更改,但是为什么不使用这种方法更新呢? The code enters this method. 代码输入此方法。
this.quotesAdapter = new QuoteAdapter(this, R.layout.mainrow, quotes);
quotesAdapter.notifyDataSetChanged();
listView.setAdapter(quotesAdapter);
Works, but why do I have to create a new adapter? 可以,但是为什么我必须创建一个新的适配器? Why can't I use my existing one? 为什么我不能使用现有的?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.