android-doc-picker
A simple and easy to use documents Picker android library. Choose any documents like pdf, ppt, text, word or media files from your device.
DocPicker Library for Android (AndroidX)
A Doc Picker library for Android for selecting single/multiple files of any type.
Setup
Step 1: Add the dependency
Usage
Step 1: Declare and Initialize DocPicker.
Java
Kotlin
Explanation:
1. DocPickerConfig:
It is use to set the configuration.
- .setAllowMultiSelection(booleanValue): tells whether to select single file or multiple file.
- .setShowConfirmationDialog(booleanValue): tells whether to show confirmation dialog on selecting the file(only work in single file selection).
- .setExtArgs(stringArrayValue): this will help in filtering the docs base on these speficied extentions(values in stringArray).
eg.
URI:
We will be returning the list of Uri after selecting the files. That's why it is better to know about Uri first.
A Uniform Resource Identifier (URI) is a compact sequence of characters that identifies an abstract or physical resource.
In Android, Content providers manage access to a structured set of data. They encapsulate the data, and provide mechanisms for defining data security. Content providers are the standard interface that connects data in one process with code running in another process.
You can get almost all information from uri.
URI usages:
- Get file from uri:
- Get mime from uri:
- Used in Glide: