https://github.com/lemberg/directory-selector-dialog-preference
https://github.com/lemberg/directory-selector-dialog-preference
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/lemberg/directory-selector-dialog-preference
- Owner: lemberg
- License: mit
- Created: 2015-02-11T13:07:12.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2015-02-12T12:19:10.000Z (over 11 years ago)
- Last Synced: 2025-03-25T13:39:16.913Z (about 1 year ago)
- Language: Java
- Size: 1.99 MB
- Stars: 11
- Watchers: 6
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

# Description
The project contains an Android library which provides directory selection functionality using **DialogFragment** and **DialogPreference** and a Demo application.
## How to use
Import the library into your project and use it in the following ways:
### Using **DialogFragment**
1. Implement **DirectoryDialog.Listener** interface in your activity:
```java
public class MainActivity extends Activity implements DirectoryDialog.Listener {
@Override
public void onDirectorySelected(File dir) {
}
@Override
public void onCancelled() {
}
// ...
}
```
2. Open directory selector dialog when needed:
```java
DialogFragment dialog = DirectoryDialog.newInstance(settings.getStorePath());
dialog.show(getFragmentManager(), "directoryDialog");
```
### Using **DialogPreference**
1. Define directory preference entry in your preferences file:
```xml
```
2. Implement your custom **PreferenceActivity** activity which will use our preference file and open it when needed (most likely on menu item click). Refer to **SettingsActivity** in Demo application for example. Note how the preference "summary" is updating there.
3. Clicking on **DirectoryPreference** entry will open a directory selection dialog. Selecting a directory will automatically save it in shared preferences using configured key.
## License
The project is available under MIT license. See the file **license** with the full license text.
## Compatibility
Minimum SDK version is 14.