Android library project for selecting/capturing multiple images from the device.
Android does not provide multi-selection of images out of the box until API 18.
- Allows taking pictures from camera as well.
- Multi-selection of images from gallery.
- Preview thumbnail of selected images.
- No dependecy.
Add camera permissions and required features to your AndroidManifest.xml
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.READ" />
Declare the PolyPicker activity in your AndroidManifest.xml
<activity
android:name="nl.changer.polypicker.ImagePickerActivity"
android:configChanges="mcc|mnc|touchscreen|orientation|uiMode|screenSize|keyboardHidden" />
Start the PolyPicker activity and get the result back.
private void getImages() {
Intent intent = new Intent(mContext, ImagePickerActivity.class);
startActivityForResult(intent, INTENT_REQUEST_GET_IMAGES);
}
@Override
protected void onActivityResult(int requestCode, int resuleCode, Intent intent) {
super.onActivityResult(requestCode, resuleCode, intent);
if (resuleCode == Activity.RESULT_OK) {
if (requestCode == INTENT_REQUEST_GET_IMAGES) {
Parcelable[] parcelableUris = intent.getParcelableArrayExtra(ImagePickerActivity.TAG_IMAGE_URI);
if(parcelableUris == null) {
return;
}
// show images using uris returned.
}
}
}
This project is inspired by and modified from an existing project mentioned below.