Learn Android App Development With Me
Visit My Visit Below ▼▼
Website Contributor ▼▼
Android Library to select files/directories from Device Storage.
License: Apache License 2.0
Learn Android App Development With Me
Visit My Visit Below ▼▼
Website Contributor ▼▼
This file picker is the best but does not support Android version 11 any solution please
I can only see this two directiories on android 11+
The readme states that latest version uses AndroidX, but FilePickerPreference imports android.preference.Preference which is deprecated in favor of AndroidX preference compat libraries.
Hi Please mention how one can set particular Extention files to be picked there is no hint in documention
Currently, for Single_mode, you still need to click on the SELECT button after selecting a file.
It is more intuitive to automatically return to the parent the moment the file is clicked.
I have implement and tested on Asus Zenfone Max Pro M1. when I selected file, the dialog doesn't dismiss but back to root directory. I selected again and the second one dismiss dialog. It also happen when I click cancel. But I called dialog.show() just one time.
I cannot change the color of the dialogue buttons what styles do I need to apply.
app parent theme - Theme.MaterialComponents.Light.DarkActionBar
dialogue - val dialogue = FilePickerDialog(activity!!,properties,R.style.mAlertDialogTheme)
style -
<style name="mAlertDialogTheme" parent="ThemeOverlay.MaterialComponents.Dialog.Alert">
<item name="android:buttonBarNegativeButtonStyle">@style/NegativeButtonStyle1</item>
<item name="android:buttonBarPositiveButtonStyle">@style/PositiveButtonStyle1</item>
<item name="android:colorAccent">@color/white</item>
</style>
<style name="NegativeButtonStyle1" parent="Widget.MaterialComponents.Button.TextButton.Dialog">
<item name="android:textColor">#FFFFFF</item>
</style>
<style name="PositiveButtonStyle1" parent="Widget.MaterialComponents.Button.TextButton.Dialog">
<item name="android:textColor">#FFFFFF</item>
</style>
How can I change the Directory Selection checkbox color, as it always white so with a white background it's overlapping.
Also there are only 5% users using Android KitKat my app does support it actually and i doesnt want to upgrade for no reason.
I just checkout your awesome project (thanks mate!) and lowered the minSDK version. It seems there is no issue by lowering it to minSDK 19 in the library gradle.build file. Testet with Firephone Android 4.4.4
Can you please downgrade the minSdk or is there any reason you dont want to?
Hi SD card is showing but Internal Storage is not showing.
I don't see any internal or external storage location even though I have WRITE_EXTERNAL_STORAGE
permission when I open file picker dialog in Android Q.
When I used this to browse the phone storage,files like jpg, mp3, png and stuff all can show. But some file types like .csv or .zip is unavailable. Like under the same directory there is a document and a photo, only the photo have its appearance in the picker dialog.
How to solve this please?
I have star it, if down to minsdk 19 will be more great
only 9 issue but 3 want down to minsdk 19 @TutorialsAndroid
When doing a select for only a directory, the user should be able to click "select" with no sub-directories selected to choose the current directory. This seems like the most intuitive form of directory selection to me, plus it is fairly difficult to hit the check boxes next to directories, so this would allow one to misclick, go insde, and still select the intended directory.
Additionally, would it be possible to add the ability to hit the check box for directories if you long-press the directory you want to select? I was very confused as to how to select the directory I wanted to choose when first using this because selecting the current directory wasn't an option and long-pressing it was my second instinct before clicking on the check box itself.
Its too narrow that's why name of some files is not visible, is there any property to change width of dialogue box?
Hi!
I want to report a bug when I update the app to SDK 33. Basically FilePicker doesn't run even though it doesn't give any error message.
compileSdkVersion 33
defaultConfig {
minSdkVersion 26
targetSdkVersion 33
.....
Regards...
Miguel Ángel
Logcat warn output:
2019-09-13 13:21:27.437 1155-1155/com.frederikmillingpytlick.container W/System.err: java.lang.NullPointerException: Attempt to get length of null array
2019-09-13 13:21:27.438 1155-1155/com.frederikmillingpytlick.container W/System.err: at com.developer.filepicker.utils.Utility.prepareFileListEntries(Utility.java:29)
2019-09-13 13:21:27.439 1155-1155/com.frederikmillingpytlick.container W/System.err: at com.developer.filepicker.view.FilePickerDialog.onStart(FilePickerDialog.java:212)
2019-09-13 13:21:27.439 1155-1155/com.frederikmillingpytlick.container W/System.err: at android.app.Dialog.show(Dialog.java:323)
2019-09-13 13:21:27.440 1155-1155/com.frederikmillingpytlick.container W/System.err: at com.developer.filepicker.view.FilePickerDialog.show(FilePickerDialog.java:389)
2019-09-13 13:21:27.440 1155-1155/com.frederikmillingpytlick.container W/System.err: at com.frederikmillingpytlick.container.MainActivity.onMenuItemClick(MainActivity.java:201)
2019-09-13 13:21:27.441 1155-1155/com.frederikmillingpytlick.container W/System.err: at android.widget.PopupMenu$1.onMenuItemSelected(PopupMenu.java:108)
2019-09-13 13:21:27.441 1155-1155/com.frederikmillingpytlick.container W/System.err: at com.android.internal.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:787)
2019-09-13 13:21:27.442 1155-1155/com.frederikmillingpytlick.container W/System.err: at com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:151)
2019-09-13 13:21:27.442 1155-1155/com.frederikmillingpytlick.container W/System.err: at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:934)
2019-09-13 13:21:27.443 1155-1155/com.frederikmillingpytlick.container W/System.err: at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:924)
2019-09-13 13:21:27.444 1155-1155/com.frederikmillingpytlick.container W/System.err: at com.android.internal.view.menu.MenuPopup.onItemClick(MenuPopup.java:128)
2019-09-13 13:21:27.444 1155-1155/com.frederikmillingpytlick.container W/System.err: at android.widget.AdapterView.performItemClick(AdapterView.java:330)
2019-09-13 13:21:27.445 1155-1155/com.frederikmillingpytlick.container W/System.err: at android.widget.AbsListView.performItemClick(AbsListView.java:1190)
2019-09-13 13:21:27.445 1155-1155/com.frederikmillingpytlick.container W/System.err: at android.widget.AbsListView$PerformClick.run(AbsListView.java:3198)
2019-09-13 13:21:27.446 1155-1155/com.frederikmillingpytlick.container W/System.err: at android.widget.AbsListView$3.run(AbsListView.java:4116)
2019-09-13 13:21:27.448 1155-1155/com.frederikmillingpytlick.container W/System.err: at android.os.Handler.handleCallback(Handler.java:883)
2019-09-13 13:21:27.449 1155-1155/com.frederikmillingpytlick.container W/System.err: at android.os.Handler.dispatchMessage(Handler.java:100)
2019-09-13 13:21:27.449 1155-1155/com.frederikmillingpytlick.container W/System.err: at android.os.Looper.loop(Looper.java:214)
2019-09-13 13:21:27.454 1155-1155/com.frederikmillingpytlick.container W/System.err: at android.app.ActivityThread.main(ActivityThread.java:7356)
2019-09-13 13:21:27.454 1155-1155/com.frederikmillingpytlick.container W/System.err: at java.lang.reflect.Method.invoke(Native Method)
2019-09-13 13:21:27.455 1155-1155/com.frederikmillingpytlick.container W/System.err: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
2019-09-13 13:21:27.455 1155-1155/com.frederikmillingpytlick.container W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
My implementation:
case R.id.item1:
DialogProperties properties = new DialogProperties();
properties.selection_mode = DialogConfigs.MULTI_MODE;
properties.selection_type = DialogConfigs.FILE_SELECT;
properties.root = new File(Environment.DIRECTORY_PICTURES);
properties.error_dir = new File(Environment.DIRECTORY_DOWNLOADS);
properties.offset = new File(DialogConfigs.DEFAULT_DIR);
FilePickerDialog dialog = new FilePickerDialog(MainActivity.this, properties);
dialog.setTitle("Select a File");
dialog.setDialogSelectionListener(new DialogSelectionListener() {
@Override
public void onSelectedFilePaths(String[] files) {
//files is the array of the paths of files selected by the Application User.
}
});
dialog.show();
return true;
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String permissions[], @NonNull int[] grantResults) {
switch (requestCode) {
case FilePickerDialog.EXTERNAL_READ_PERMISSION_GRANT: {
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
if(dialog!=null)
{ //Show dialog if the read permission has been granted.
dialog.show();
}
}
else {
//Permission has not been granted. Notify the user.
Toast.makeText(MainActivity.this,"Permission is Required for getting list of files",Toast.LENGTH_SHORT).show();
}
}
}
}
That would include Andorid 4.4
compileSdkVersion 30 and targetSdkVersion 30 on API 29 devices is ok, on API 30 throwing exception "NoSuchMethodException" for "TypefaceCompatApi26Impl" class.
With result: explorer doesn't show files, only folders.
upd: implementation 'androidx.appcompat:appcompat:1.2.0-rc01' solved the exception. But files still not present, I guess because of some api changes in storage, compileSdkVersion 29 works fine.
W/.qqq: Accessing hidden method Landroid/graphics/FontFamily;-><init>()V (greylist-max-q, reflection, denied)
/com.example.qqq E/TypefaceCompatApi26Impl: Unable to collect necessary methods for class java.lang.NoSuchMethodException
java.lang.NoSuchMethodException: android.graphics.FontFamily.<init> []
at java.lang.Class.getConstructor0(Class.java:2332)
at java.lang.Class.getConstructor(Class.java:1728)
at androidx.core.graphics.TypefaceCompatApi26Impl.obtainFontFamilyCtor(TypefaceCompatApi26Impl.java:321)
at androidx.core.graphics.TypefaceCompatApi26Impl.<init>(TypefaceCompatApi26Impl.java:84)
at androidx.core.graphics.TypefaceCompatApi28Impl.<init>(TypefaceCompatApi28Impl.java:36)
at androidx.core.graphics.TypefaceCompat.<clinit>(TypefaceCompat.java:47)
at androidx.core.graphics.TypefaceCompat.create(TypefaceCompat.java:190)
at androidx.appcompat.widget.AppCompatTextView.setTypeface(AppCompatTextView.java:705)
at android.widget.TextView.resolveStyleAndSetTypeface(TextView.java:2183)
at android.widget.TextView.setTypefaceFromAttrs(TextView.java:2154)
at android.widget.TextView.applyTextAppearance(TextView.java:4105)
at android.widget.TextView.<init>(TextView.java:1630)
at android.widget.TextView.<init>(TextView.java:990)
at androidx.appcompat.widget.AppCompatTextView.<init>(AppCompatTextView.java:99)
at com.google.android.material.textview.MaterialTextView.<init>(MaterialTextView.java:91)
at com.google.android.material.textview.MaterialTextView.<init>(MaterialTextView.java:86)
at com.google.android.material.textview.MaterialTextView.<init>(MaterialTextView.java:81)
at com.google.android.material.theme.MaterialComponentsViewInflater.createTextView(MaterialComponentsViewInflater.java:109)
at androidx.appcompat.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:103)
at androidx.appcompat.app.AppCompatDelegateImpl.createView(AppCompatDelegateImpl.java:1407)
at androidx.appcompat.app.AppCompatDelegateImpl.onCreateView(AppCompatDelegateImpl.java:1457)
at android.view.LayoutInflater.tryCreateView(LayoutInflater.java:1059)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:995)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:959)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1121)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1082)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1124)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1082)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1124)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1082)
at android.view.LayoutInflater.parseInclude(LayoutInflater.java:1261)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1117)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1082)
at android.view.LayoutInflater.inflate(LayoutInflater.java:680)
at android.view.LayoutInflater.inflate(LayoutInflater.java:532)
at android.view.LayoutInflater.inflate(LayoutInflater.java:479)
at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:469)
at android.app.Dialog.setContentView(Dialog.java:569)
at com.developer.filepicker.view.FilePickerDialog.onCreate(FilePickerDialog.java:82)
at android.app.Dialog.dispatchOnCreate(Dialog.java:419)
at android.app.Dialog.show(Dialog.java:313)
at com.developer.filepicker.view.FilePickerDialog.show(FilePickerDialog.java:389)
at com.example.qqq.showPickBlankDialog(qqq.java:213)
at com.example.qqq.onCreate(qqq.java:80)
at android.app.Activity.performCreate(Activity.java:7995)
at android.app.Activity.performCreate(Activity.java:7979)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1309)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3422)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3601)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
/com.example.qqq E/TypefaceCompatApi26Impl: at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
can i pick extension just image and doc???
In Android 11 there no files and folders in internal storage.
even I add the line in the android manifest file.
android:requestLegacyExternalStorage="true"
https://i.imgur.com/1aw0txo.jpg
https://i.imgur.com/zpe7UWW.jpg
firstly thank you for your work;
secondly i can't see the external sd card;
thirdly can you show file size?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.