一旦内容提供商的更新,我怎么能告诉所有监听器有一个更新?监听器、提供商、有一个、内容

2023-09-06 18:17:02 作者:动荡乾坤

嗨基本上我有一个表,这个表正从我写了一个内容提供商的信息。如果我更新内容供应商我怎么能强迫当数据在内容提供商改变的UI更新?

Hi basically I have a table, this table is getting information from a content provider I wrote. If I update a content provider how can I force an update on the UI whenever the data is changed in the content provider?

例如:如果列表被显示一个乙

FOr example: If a list is showing A B

和我添加C到内容提供商

and I add C to the content provider

我怎么能得到用户界面,显示一个乙C只要它更新?或者它会自动播放任何改变我吗?

how can I get the UI to show A B C as soon as it updates? Or does it automatically broadcast any changes for me?

推荐答案

查看这后,该谈的内容观察员。我会说听的变化,当一个发生更新列表。由于您的应用程序是一个做插入(尽管其他人可能也一样),你可以只插入一条记录后更新列表。

Check out this post, which talks about content observers. I would say listen for changes, when one occurs update your list. Since your application is the one doing the inserting (although others may as well), you could just update your list after inserting a record.