Skip to content

Getting Started Guide

Ashish Shekar edited this page Dec 24, 2016 · 2 revisions

Simple Implementation

Just like a AlertDialog Builder this Chooser has a same structure of implementation. Please keep in mind that you'll implement this if you need the user to choose a directory for you to save your data. This is not a file picker.

Initialize a builder

StorageChooser chooser = new StorageChooser.Builder();

Now that your Builder is initialized you can pass the following parameters to the Storage Chooser.

  • withActivity(Activity activity)

-> this is a compulsary parameter to pass. Since without this dialog will never show.

  • withFragmentManager(FragmentManager fm)

-> passing activity will not be able to fetch the fragment manager of the support library. so pass the fragment manager by getSupportFragmentManager() if you are extending AppCompatActivity.

  • withMemoryBar(boolean showMemoryBar)

-> passing true will show a nice memory bar with the storage dialog

  • build()

-> this will return the StorageChooser object.

At this point you can just show the dialog by

chooser.show();

Clone this wiki locally