@Override protected void onCreate(@Nullable final Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.dialog); final DirectoryChooserConfig config = DirectoryChooserConfig.builder().newDirectoryName("DialogSample").build(); mDialog = DirectoryChooserFragment.newInstance(config); mDirectoryTextView = (TextView) findViewById(R.id.textDirectory); findViewById(R.id.btnChoose) .setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { mDialog.show(getFragmentManager(), null); } }); }
@Override public void onCancelChooser() { mDialog.dismiss(); }
@Override public void onSelectDirectory(@NonNull final String path) { mDirectoryTextView.setText(path); mDialog.dismiss(); }