/storage/emulated/0 IS BLANK. (using nbsp-team/ Material File Picker)

旧城冷巷雨未停 提交于 2019-12-02 13:28:21

问题


I am having trouble with using nbsp-team/ Material File Picker

When I was testing it on my phone a LG-G2 Mini running android lollipop and my tablet a Samsung Tab8.4 running Android Kitkat 4.4 the directories were able to load, I can navigate through my internal storage and select the file. However, as I used my app on my classmate's phone a Samsung J7 and a Samsung J5 both running Android 7.0 Nougat. The /storage/emulated/0 was just a blank screen, there were no folders to go to.

I am using com.nbsp:library:1.8

Here is the way I get the file path.

private void getCSV(){

    new MaterialFilePicker()
            .withActivity(this)
            .withRequestCode(1)
            .withFilter(Pattern.compile(".*\\.csv$")) // Filtering files and directories by file name using regexp
            .withFilterDirectories(false) // Set directories filterable (false by default)
            .withHiddenFiles(true) // Show hidden files and folders
            .start();
}


@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if (requestCode == 1 && resultCode == RESULT_OK) {
        String filePath = data.getStringExtra(FilePickerActivity.RESULT_FILE_PATH);
        // Do anything with file
        setFILE_PATH(filePath);
        txt_csvPath.setText(filePath);
        btn_build.setVisibility(View.VISIBLE);
    }
}

Is there anything I can do about this?

Link:

https://github.com/nbsp-team/MaterialFilePicker


回答1:


Try this:

private void getCSV(){
   new MaterialFilePicker()
            .withActivity(this)
            .withRequestCode(1)
            .withHiddenFiles(true)
            .withTitle("Choose File")
            .start();
}

You can also refer sample code Here



来源:https://stackoverflow.com/questions/49358805/storage-emulated-0-is-blank-using-nbsp-team-material-file-picker

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!