storage-chooser icon indicating copy to clipboard operation
storage-chooser copied to clipboard

WithPredefinedPath not working

Open yhs0602 opened this issue 5 years ago • 1 comments

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?

yhs0602 avatar Oct 09 '18 03:10 yhs0602

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.

codekidX avatar Sep 04 '19 16:09 codekidX