This is Telegram like File Picker for android .
- Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
- Add the dependency
dependencies {
implementation 'com.github.smartdevelopers-ir:SmartFilePicker:1.5.2'
}
- open File Picker
Bundle extra=new Bundle();
extra.putInt("my_number",10);
Intent intent = new SmartFilePicker.IntentBuilder()
.showCamera(true)
.canSelectMultipleInGallery(true)
.showGalleryTab(true)
.showPickFromSystemGalleyMenu(true)
.setExtra(extra)
.setFileFilter(new SFBFileFilter.Builder().isFile(true).isFolder(true).build())
.canSelectMultipleInFiles(true)
.build(this);
startActivityForResult(intent, 10);
- Getting result
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode==10){
if (data!=null) {
Uri[] uris= SmartFilePicker.getResultUris(data);
if (uris!=null){
// do somthing with selected files uri
}
Bundle extra= SmartFilePicker.getExtra(data);
if (extra != null) {
int number = extra.getInt("my_number");
}
}
}
}
You can support me by donating with cryptocurrency :)