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:
Try this:
You can also refer sample code Here