Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/date/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 在ContentProvider中对多个URI使用notifyChange是否正确?_Android_Android Contentprovider - Fatal编程技术网

Android 在ContentProvider中对多个URI使用notifyChange是否正确?

Android 在ContentProvider中对多个URI使用notifyChange是否正确?,android,android-contentprovider,Android,Android Contentprovider,给定两个URI: 在ContentProvider的查询方法中用于检索多个内容的URI: content://my-authority/things ContentProvider的更新方法中使用的URI,该方法指向单个对象(如果与查询方法一起使用,则相同的URI检索对象123): content://my-authority/thing/123 我的问题: 在更新方法中,两次notifyChange是否正确,对于上面的每个URI一次 什么让我这么问: 如果事物的列表视图自动与SQLite数据保

给定两个URI:

  • 在ContentProvider的查询方法中用于检索多个内容的URI:

    content://my-authority/things

  • ContentProvider的更新方法中使用的URI,该方法指向单个对象(如果与查询方法一起使用,则相同的URI检索对象123):

    content://my-authority/thing/123

  • 我的问题:
    在更新方法中,两次notifyChange是否正确,对于上面的每个URI一次

    什么让我这么问:
    如果事物的列表视图自动与SQLite数据保持同步(通过.SimpleCursorAdapter、LoaderManger.LoaderCallbacks和第一个URI),如果事物123被更新并且只通知该id,则列表视图不会得到通知/反映更新


    我肯定我误解了一些东西,还有一个更优雅的解决方案。

    您只需要通知第二个URI的更改(如果正在更新)。如果插入,请更改第一个URI