Image Preview Library for Android (AndroidX)
A Image Preview library for Android for selecting single/multiple files of any type.
Setup
Step 1: Add the dependency
Usage
Step 1: Declare and Initialize ImagePreview.
Java
Kotlin
Explanation:
1. ImagePreviewConfig:
It is use to set the configuration.
- .setAllowAddButton(booleanValue): tells whether to show add button in preview activity.
- .setUris(arrayList of Uri): set array of image(uri) to be send for preview
eg.
2. ExtraListener:
Call back listener when user clicked add button or done button.
eg.
3. Manually dismissing ImagePreview:
URI:
We will be returning the list of Uri after done button is clicked. 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: