# android-multiple-images-selector
**Repository Path**: songgx.code.osc/android-multiple-images-selector
## Basic Information
- **Project Name**: android-multiple-images-selector
- **Description**: No description available
- **Primary Language**: Unknown
- **License**: MIT
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2016-07-26
- **Last Updated**: 2024-06-22
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# Android Multiple Images Selector
Easy-to-use library to select images in Android application
Features:
* select images by folders
* support to set max number of images to be selected
* allow filter images with tiny size (configurable)
* fast scroll of image list
* support to capture images from camera
* compitable with android 6.0
* support Chinese / English
NOTE: this library depends on Fresco / rxjava.
# How does it work (GIF)
 
Download demo apk here: [demo](multiple-images-selector-demo.apk)
# How to use this library in your application
## 1. add "multiple-images-selector" dependency
multiple-images-selector is now available in jcenter.
Add "multiple-images-selector" as dependency to your app:
compile 'com.zfdang.multiple-images-selector:multiple-images-selector:1.1.3'
## 2. Initialize Fresco & Add selector activity in your app's manifest
Permission & Application & Activity:
Application intialization:
public class DemoApplication extends Application
{
@Override
public void onCreate() {
super.onCreate();
// the following line is important
Fresco.initialize(getApplicationContext());
}
}
## 3. Launch images selector:
// class variables
private static final int REQUEST_CODE = 123;
private ArrayList mResults = new ArrayList<>();
// start multiple photos selector
Intent intent = new Intent(DemoActivity.this, ImagesSelectorActivity.class);
// max number of images to be selected
intent.putExtra(SelectorSettings.SELECTOR_MAX_IMAGE_NUMBER, 5);
// min size of image which will be shown; to filter tiny images (mainly icons)
intent.putExtra(SelectorSettings.SELECTOR_MIN_IMAGE_SIZE, 100000);
// show camera or not
intent.putExtra(SelectorSettings.SELECTOR_SHOW_CAMERA, true);
// pass current selected images as the initial value
intent.putStringArrayListExtra(SelectorSettings.SELECTOR_INITIAL_SELECTED_LIST, mResults);
// start the selector
startActivityForResult(intent, REQUEST_CODE);
## 4. get results by
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// get selected images from selector
if(requestCode == REQUEST_CODE) {
if(resultCode == RESULT_OK) {
mResults = data.getStringArrayListExtra(SelectorSettings.SELECTOR_RESULTS);
assert mResults != null;
// show results in textview
StringBuffer sb = new StringBuffer();
sb.append(String.format("Totally %d images selected:", mResults.size())).append("\n");
for(String result : mResults) {
sb.append(result).append("\n");
}
tvResults.setText(sb.toString());
}
}
super.onActivityResult(requestCode, resultCode, data);
}
## 5. Q&A:
Issue 1:
android.view.InflateException: Binary XML file line #7: Binary XML file line #7: Error inflating class com.facebook.drawee.view.SimpleDraweeView
Solution: make sure Fresco is initialized in app properly.
android:name=".DemoApplication"
...
Fresco.initialize(getApplicationContext());
Issue 2:
App crash while loading large amount of images
Solution: disable hardware acceleration for activity
# License
Multiple-Images-Selector is [MIT-licensed](LICENSE).