Difference between ContentObserver and DatasetObserver?

前端 未结 4 2037
你的背包
你的背包 2021-01-30 11:15

What is difference between ContentObserver and DatasetObserver?

When one or another should be used?

I get Cursor with sing

4条回答
  •  走了就别回头了
    2021-01-30 11:28

    I'm not sure if this question is still on anyone's radar. I have been struggling with the same question for a little while now. What I came up with as my litmus test for deciding whether to use a DataSet Observer or a ContentObserver is pretty straight-forward:

    If I need to send a URI in my notification I use a ContentObserver. If I simply need to notify one object that another object has changed -- I use a DataSetObserver.

    The delimiting factor, for me at least, is does the object that is sending out the notification expose it's underlying resources (be they objects, records, queries, or cursors) as "Universal Resource Identifiers" to the rest of the application; or does the object hide the source of its data.

提交回复
热议问题