duyuxuan / MaterialFilePicker

Picking files since 2015

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Material File Picker Android Arsenal Download

Material file picker library for Android


Add repository url and dependency in application module gradle file:

repositories {

dependencies {
    implementation 'com.nbsp:materialfilepicker:1.9.1'

Open file picker:

    // Pass a source of context. Can be:
    //    .withActivity(Activity activity)
    //    .withFragment(Fragment fragment)
    //    .withSupportFragment(androidx.fragment.app.Fragment fragment)
    // With cross icon on the right side of toolbar for closing picker straight away
    // Entry point path (user will start from it)
    // Root path (user won't be able to come higher than it)
    // Showing hidden files
    // Want to choose only jpg images
    // Don't apply filter to directories names
    .withTitle("Sample title")

Override on activity result:

protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if (requestCode == 1 && resultCode == RESULT_OK) {
        String filePath = data.getStringExtra(FilePickerActivity.RESULT_FILE_PATH);
        // Do anything with file

Runtime permissions:

You should handle runtime permissions in activity, from what you called Material File Picker. Look here for example code.

Third Party Bindings

React Native

You may now use this library with React Native via the module here


Picking files since 2015

License:Apache License 2.0


Language:Java 79.9%Language:Kotlin 20.1%