android-folderchooser
ramiloif
7
Visit GitHub RepoOther Pickers

android-folderchooser

A simple alert dialog allows the user to choose a directory .

Download

compile 'com.io.tools.android.ramiloif.folderchooser:folderchooser-dialog:1.0.6'

Usage

  • Create a dialog using builder
ChooseDirectoryDialog dialog =
  ChooseDirectoryDialog.builder(MainActivity.this). // Context
  titleText("Choose directory"). // The title will be shown
  startDir(Environment.getExternalStorageDirectory().getAbsoluteFile()).// File from where to start
  showNeverAskAgain(true). // Enable or disable 'Never ask again checkbox
  neverAskAgainText("Never ask again"). // Text of never ask again check box(if enabled)
  onPickListener(new ChooseDirectoryDialog.DirectoryChooseListener() {
      @Override
      public void onDirectoryPicked(ChooseDirectoryDialog.DialogResult result) {
          // Listener to users choice
          // result.getPath() - The path of the folder picked by user
          // result.isAskAgain()  - Did the user checked the 'Never ask again' Checkbox if true it means never ask again
          resultTV.setText("You picked \n " + 
          result.getPath() +
          "\n Never ask again = " +
          result.isAskAgain());
      }

      @Override
      public void onCancel() {
          resultTV.setText("operation canceled");
      }
  }).build();
dialog.show();

Requirements

Read external storage permission

  <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
Become a better Android Developer
Millions of developers are learning at MindOrks

Online Training Program

Featured Blogs

Our Team

MindOrks is Certainly one of the best online blog to stay on top of all the Android development news, coding and design patterns. Finally a blog I can count on to keep myself updated with latest and greatest things happening in Android world.

Vipul Shah
Android Developer
Microsoft

Become Pro in Android by watching videos

OUR LEARNERS WORK AT