@Override public void onClick(View v) { switch (v.getId()) { case R.id.textPath: Toast.makeText(this, thisFolder.getPath(), Toast.LENGTH_LONG).show(); break; case R.id.btnChange: Intent intent = new Intent(this, DirectoryChooserActivity.class); intent.putExtra( DirectoryChooserActivity.EXTRA_CONFIG, DirectoryChooserConfig.builder() .initialDirectory(thisFolder.getPath()) .newDirectoryName("SaveThis") .build()); startActivityForResult(intent, REQUEST_DIRECTORY); break; } }
@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); } }); }