我在使用 nbsp-team/Material File Picker 时遇到问题
当我在手机上测试它时,运行Android棒棒糖的LG-G2 Mini和我的平板电脑运行Android Kitkat 4.4的三星Tab8.4目录能够加载,我可以浏览我的内部存储并选择文件。但是,当我在同学的手机上使用我的应用程序时,三星J7和三星J5都运行Android 7.0牛轧糖。/storage/emulated/0只是一个空白屏幕,没有文件夹可以转到。
我正在使用com.nbsp:library:1.8
这是我获取文件路径的方式。
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();
}
您也可以参考示例代码 此处