Skip to content

Simple directory picker Activity

Notifications You must be signed in to change notification settings

didim99/DirPicker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

DirPicker

Simple directory picker Activity

Getting started

Dependencies

Add in your build.gradle:

android {
  ...
  defaultConfig {
    ...
    vectorDrawables.useSupportLibrary = true
  }
  ...
}
...
dependencies {
  ...
  implementation 'com.android.support:appcompat-v7:26+'
  implementation 'com.android.support:recyclerview-v7:26+'
  compile 'com.android.support:support-vector-drawable:26+'
}

Resources

/res directory contains all necessary resources. Colors optimized for default (dark) AppCompat theme.

Using

To start DirPicker use:

public class MainActivity extends AppCompatActivity {
...
  private static final int REQUEST_CHOOSE_DIR = 1;
...
  void choosePath () {
    Intent intent = new Intent(this, DirPickerActivity.class);
    startActivityForResult(intent, REQUEST_CHOOSE_DIR);
  }
...
}

To get choosed path use:

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent i) {
  if (requestCode == REQUEST_CHOOSE_DIR && resultCode == RESULT_OK) {
    Uri data = i.getData();
    if (data != null) {
      String extPath = data.getPath();
    }
  }
}

About

Simple directory picker Activity

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages