游标始终在查询

时间:2017-06-05 21:13:59

标签: android android-contentprovider android-cursor

我正在使用Intent从我的Android设备中选择一个文件。当显示选择器时,我选择Astro文件管理器,然后继续选择文件(在这种情况下是一个视频)。

我收回了一个URI(content://com.metago.astro.filecontent/file/file/sdcard/Download/video_video.mp4),我试图用以下方法处理它:

    Cursor cursor = null;
    final String column = null;
    final String[] projection = null;

    try {
        cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs, null);

        if (cursor != null && cursor.moveToFirst()) {
            // Never enters here because cursor always null
            L.p("Hi!");
        }
    } catch (Exception e) {
        L.p(e.getMessage()); // Never hit
    } finally {
        if (cursor != null)
            cursor.close();
    }

但是光标始终返回null。知道为什么会这样吗?

0 个答案:

没有答案
相关问题