storage-chooser
storage-chooser copied to clipboard
WithPredefinedPath not working
settingPath=getSharedPreferences("path",MODE_PRIVATE);
String prepath=settingPath.getString(DiskUtil.SC_PREFERENCE_KEY,"/storage/emulated/0/");
File tmp=new File(prepath);
if(tmp.isFile())
{
tmp=tmp.getParentFile();
prepath=tmp.getAbsolutePath();
}
StorageChooser chooser = new StorageChooser.Builder()
.withActivity(MainActivity.this)
.withFragmentManager(getFragmentManager())
.withMemoryBar(true)
.allowCustomPath(true)
.setType(StorageChooser.FILE_PICKER)
.actionSave(true)
//.withPreference(settingPath)
.withPredefinedPath(prepath)
.build();
// Show dialog whenever you want by
chooser.show();
// get path that the user has chosen
chooser.setOnSelectListener(new StorageChooser.OnSelectListener() {
@Override
public void onSelect(String path) {
SharedPreferences.Editor edi=settingPath.edit();
edi.putString(DiskUtil.SC_PREFERENCE_KEY,path);
edi.commit();
OnChoosePath(path);
//Log.e("SELECTED_PATH", path);
}
});
Any clues?
Hey, sorry I couldn't be of much help in this. I will be discontinuing this feature in 3.0 due to many reasons out of which internal path is way different in Chinese OEMs and you cannot guess it.
Although I saw workaround and I might fix it in a release. Thanks for this.