代码之家  ›  专栏  ›  技术社区  ›  Mohammad Nikravan

如何通过android在sdcard中搜索特定的文件名ContentResolver.query使用选择和选择标记?

  •  1
  • Mohammad Nikravan  · 技术社区  · 7 年前

    selection = "_display_name='111'"; //I haven't use selectionArgs here for simplicity 
    context.contentResolver.query(childrenUri, projection, selection, null, null)
    

    我也尝试过“_display_name=?”并使用selectionags,但它看起来提供者完全忽略我的选择,总是返回目录中的所有文件。

    我已经用三星S7-android8进行了测试。

    0 回复  |  直到 7 年前
        1
  •  0
  •   Paul W    6 年前

    假设您使用的提供程序是 androidx.core.content.FileProvider selection , selectionArgs sortOrder FileProvider.query 是。。。 在AndroidX的实现中使用!

    here (第409行)

    post查询,在您自己的代码中 是的,这有点悲哀。。。

    推荐文章
    Mygod  ·  使用存储访问框架
    11 年前