Material file picker library for Android
Add repository url and dependency in application module gradle file:
repositories {
maven {
url "http://dl.bintray.com/lukaville/maven"
}
}
dependencies {
compile 'com.nbsp:library:1.02'
}
Open file picker:
Intent intent = new Intent(this, FilePickerActivity.class);
startActivityForResult(intent, 1);
Ovveride on activity result:
@Override
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
}
}