如何在不刷新其他项目的情况下向RecyclerView中添加新项目。

huangapple go评论82阅读模式
英文:

How to add new item in recyclerview without refreshing other item

问题

I'm developing chat application. Every thing works fine but when data is added or removed from then from the chat then how to update that item without disturbing other just like Facebook and Whatsapp.

这是我的数据库。

我知道mAdapter.notifyItemInserted(position);,但如何在嵌套的RecyclerView中使用呢?

英文:

I'm developing chat application. Every thing works fine but when data is added or removed from then from the chat then how to update that item without disturbing other just like Facebook and Whatsapp.
如何在不刷新其他项目的情况下向RecyclerView中添加新项目。

This is my database.

如何在不刷新其他项目的情况下向RecyclerView中添加新项目。

i know about mAdapter.notifyItemInserted(position); but how we do for nested recyclerview ?

答案1

得分: 1

要更新特定行,您可以使用以下代码:
mAdapter.notifyItemChanged(position)
英文:

To update a particular row, you can use following

mAdapter.notifyItemChanged(position)

答案2

得分: 0

使用FirebaseUI进行实时数据库

FirebaseRecyclerAdapter将查询绑定到RecyclerView。当数据被添加、移除或更改时,这些更新会实时自动应用到您的用户界面中。

查看此链接Firebase实时数据库的Firebase UI

您不会后悔的。

英文:

use FirebaseUI for Realtime Database

The FirebaseRecyclerAdapter binds a Query to a RecyclerView. When data is added, removed, or changed these updates are automatically applied to your UI in real time.

see this link Firebase UI for realtime database

you won't regret with

huangapple
  • 本文由 发表于 2020年1月3日 15:30:44
  • 转载请务必保留本文链接:https://go.coder-hub.com/59574749.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定