/storage/emulated/0为空白. (使用nbsp-team/材料文件选取器) [英] /storage/emulated/0 IS BLANK. (using nbsp-team/ Material File Picker)

查看:1057
本文介绍了/storage/emulated/0为空白. (使用nbsp-team/材料文件选取器)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用nbsp-team/Material File Picker时遇到问题

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

当我在手机上测试运行android棒棒糖的LG-G2 Mini以及在运行Android Kitkat 4.4的平板电脑运行Samsung Tab8.4的手机上进行测试时,可以浏览内部存储并选择文件.但是,当我在同学的手机上使用我的应用程序时,三星J7和三星J5都运行Android 7.0牛轧糖./storage/emulated/0只是一个空白屏幕,没有文件夹可访问.

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.

我正在使用com.nbsp:library:1.8

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);
    }
}

对此我能做些什么吗?

链接:

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

推荐答案

尝试一下:

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

您也可以在此处引用示例代码

这篇关于/storage/emulated/0为空白. (使用nbsp-team/材料文件选取器)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆