简体   繁体   English

notifyDataSetChanged()不会更新ListView

[英]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.

相关问题 BaseAdapter.notifyDataSetChanged不会更新其ListView - BaseAdapter.notifyDataSetChanged doesn't update its ListView 在通知适配器后,notifyDataSetChanged()不会更新ListView - notifyDataSetChanged() doesn't update ListView after the adapter being notified 在notifyDataSetChanged之后,ListView不会直观地更新其内容 - ListView doesn't visually update its content after notifyDataSetChanged 使用notifyDataSetChanged()时,Android API ListView不会更新; - Android API ListView doesn't update when using notifyDataSetChanged(); ListView 不会使用 notifydatasetchanged 刷新 - ListView doesn't refresh with notifydatasetchanged ListView不会在notifyDataSetChanged上刷新 - ListView doesn't refresh on notifyDataSetChanged 多列ListView不会使用notifyDataSetChanged()刷新 - Multicolumn ListView doesn't refresh using notifyDataSetChanged() 使用notifyDataSetChanged动态更新listview不起作用 - Dynamically updating listview with notifyDataSetChanged doesn't work RecyclerView适配器不会在notifyDataSetChanged()(不是Collection)上更新 - RecyclerView adapter doesn't update on notifyDataSetChanged() (not Collection) BaseAdapter notifyDataSetChanged()不更新对象引用 - BaseAdapter notifyDataSetChanged() doesn't update object reference
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM