Android library that provides for multiple image selection.

Overview

#MultipleImageSelect

Alt text

An android library that allows selection of multiple images from gallery. It shows an initial album (buckets) chooser and then images in selected album. Can limit the number of images that can be selected. Can be used in apps with APK 11 onwards.

Sample app can be found here #Usage Include this library in your project using gradle (thanks to JitPack.io).

For stable build:

repositories {
  maven {
    url "https://jitpack.io"
  }
}

dependencies {
  compile 'com.github.darsh2:MultipleImageSelect:v0.0.4'
}

For using the latest build, replace the tag in dependencies above with latest commit hash. Example:

repositories {
  maven {
    url "https://jitpack.io"
  }
}

dependencies {
  compile 'com.github.darsh2:MultipleImageSelect:3474549'
}

In project's AndroidManifest.xml, add the following under application node:

<activity
  android:name="com.darsh.multipleimageselect.activities.AlbumSelectActivity"
  android:theme="@style/MultipleImageSelectTheme">
  <intent-filter>
    <category android:name="android.intent.category.DEFAULT" />
  </intent-filter>
</activity>

In the activity from where you want to call image selector, create Intent as follows:

Intent intent = new Intent(this, AlbumSelectActivity.class);
//set limit on number of images that can be selected, default is 10
intent.putExtra(Constants.INTENT_EXTRA_LIMIT, numberOfImagesToSelect);
startActivityForResult(intent, Constants.REQUEST_CODE);

and override onActivityResult as follows:

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
  if (requestCode == Constants.REQUEST_CODE && resultCode == RESULT_OK && data != null) {
    //The array list has the image paths of the selected images
    ArrayList<Image> images = data.getParcelableArrayListExtra(Constants.INTENT_EXTRA_IMAGES);
    ...  
}

#Custom Styles Alt text

  1. To change the color of UI elements, in colors.xml file, override the following attributes with the desired colors. Example:
<color name="multiple_image_select_primary">#673AB7</color>
<color name="multiple_image_select_primaryDark">#512DA8</color>
<color name="multiple_image_select_primaryLight">#D1C4E9</color>
<color name="multiple_image_select_accent">#536DFE</color>
<color name="multiple_image_select_primaryText">#212121</color>
<color name="multiple_image_select_secondaryText">#727272</color>
<color name="multiple_image_select_divider">#B6B6B6</color>
<color name="multiple_image_select_toolbarPrimaryText">#FFFFFF</color>
<color name="multiple_image_select_albumTextBackground">#99FFFFFF</color>
<color name="multiple_image_select_imageSelectBackground">#000000</color>    

Alt text

  1. To change the theme altogether, do step 1, and make the following changes in styles.xml and manifest file:

styles.xml: Create the theme you want to use along with a theme for toolbar and actionmode. Example:

<style name="OverrideMultipleImageSelectTheme" parent="Theme.AppCompat.NoActionBar">
  <item name="colorPrimary">@color/multiple_image_select_primary</item>
  <item name="colorPrimaryDark">@color/multiple_image_select_primaryDark</item>
  <item name="colorAccent">@color/multiple_image_select_accent</item>
  <item name="actionModeStyle">@style/OverrideCustomActionModeStyle</item>
  <item name="windowActionModeOverlay">true</item>
</style>
<style name="OverrideCustomActionModeStyle" parent="Base.Widget.AppCompat.ActionMode">
  <item name="background">@color/multiple_image_select_primary</item>
</style>
<style name="OverrideCustomToolbarTheme" parent="Base.ThemeOverlay.AppCompat.ActionBar">
</style>

AndroidManifest.xml: Add tools:replace="android:theme" to AlbumSelectActivity and ImageSelectActivity and specify theme to use. Example:

<manifest ...
  xmlns:tools="http://schemas.android.com/tools"
  ...>
  
  <activity android:name="com.darsh.multipleimageselect.activities.AlbumSelectActivity"
		tools:replace="android:theme"
    android:theme="@style/OverrideMultipleImageSelectTheme">
    <intent-filter>
      <category android:name="ANDROID.INTENT.CATEGORY.DEFAULT" />
    </intent-filter>
    </activity>
  <activity android:name="com.darsh.multipleimageselect.activities.ImageSelectActivity"
    tools:replace="android:theme"
    android:theme="@style/OverrideMultipleImageSelectTheme">
    <intent-filter>
      <category android:name="ANDROID.INTENT.CATEGORY.DEFAULT" />
    </intent-filter>
  </activity>

#Screenshots Can be found here #Apps using this Gallery Organizer

PictureJam Collage Maker #Similar Projects Similar libraries can be found here #Acknowledgements This library makes use of Glide by Bump Technologies. (Thanks to WindSekirun for suggesting Glide) #License

Copyright 2015 Darshan Dorai

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Comments
  • NullPointerException on fast tapping

    NullPointerException on fast tapping

    Hello. We hope you still provide support for MultipleImageSelect.

    We've met some issues while using your image picker, which you can reproduce as follows:

    1. Open Gallery
    2. Perform a fast tap on the "Photos" folder
    3. Perform a fast tap on an image which thumbnail wasn't yet loaded
    4. Perform a fast tap on "Add" button

    As the result, the activity reloads, and then, when you try to choose any of available images and hit the "Add" button, you'll get a crash with the following stack trace:

    java.lang.NullPointerException: Attempt to invoke virtual method 'void android.os.Handler.removeCallbacksAndMessages(java.lang.Object)' on a null object reference android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3656) android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:3710) android.app.ActivityThread.access$1400(ActivityThread.java:147) android.app.ActivityThread$H.handleMessage(ActivityThread.java:1340) android.os.Handler.dispatchMessage(Handler.java:102) android.os.Looper.loop(Looper.java:135) android.app.ActivityThread.main(ActivityThread.java:5260) java.lang.reflect.Method.invoke(Native Method) java.lang.reflect.Method.invoke(Method.java:372) com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899) com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)

    java.lang.NullPointerException: Attempt to invoke virtual method 'void android.os.Handler.removeCallbacksAndMessages(java.lang.Object)' on a null object reference com.darsh.multipleimageselect.activities.ImageSelectActivity.onStop(ImageSelectActivity.java:150) android.app.Instrumentation.callActivityOnStop(Instrumentation.java:1261) android.app.Activity.performStop(Activity.java:6127) android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3651) android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:3710) android.app.ActivityThread.access$1400(ActivityThread.java:147) android.app.ActivityThread$H.handleMessage(ActivityThread.java:1340) android.os.Handler.dispatchMessage(Handler.java:102) android.os.Looper.loop(Looper.java:135) android.app.ActivityThread.main(ActivityThread.java:5260) java.lang.reflect.Method.invoke(Native Method) java.lang.reflect.Method.invoke(Method.java:372) com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899) com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)

    We have suceeded to reproduce this on following devices:

    Dalvik/2.1.0 (Linux; U; Android 6.0; Nexus 5X Build/MDA89E) Dalvik/2.1.0 (Linux; U; Android 5.0; K016 Build/LRX21V)

    bug help wanted 
    opened by BassDay 4
  • Image adding limitation toast message not working

    Image adding limitation toast message not working

    Hi, If user select more then configured images, then after pressing "ADD" button, "Can select maximum of 0 images" toast displaying. Instead of that, It should display configured number.

    opened by nimitsolanki 4
  • Permission denial error

    Permission denial error

    Hey guys,

    Im getting this error ... Ive tried setting android:exported = true in my manifest as well, but it doesn't work. And I've also provided the read/write permissions.

    10-05 12:15:21.611 28063-28171/com.sand5.giflab E/AndroidRuntime: java.lang.SecurityException: Permission Denial: reading com.android.providers.media.MediaProvider uri content://media/external/images/media from pid=28063, uid=10151 requires android.permission.READ_EXTERNAL_STORAGE, or grantUriPermission()

    Please help me out... Thanks

    opened by jeetdholakia 2
  • java.lang.ClassCastException: com.darsh.multipleimageselect.models.Image cannot be cast to java.lang.String

    java.lang.ClassCastException: com.darsh.multipleimageselect.models.Image cannot be cast to java.lang.String

    ArrayList images = data.getStringArrayListExtra(com.darsh.multipleimageselect.helpers.Constants.INTENT_EXTRA_IMAGES);

    Gives a class cast exception. It was working earlier.

    opened by harshvishu 2
  • Can not move back-and-forth in image picker

    Can not move back-and-forth in image picker

    There is no back button on the actionBar. If by mistake i have selected a wrong album i have to go back entirely and open the image picker again. Is there any way to avoid this.

    opened by harshvishu 2
  • Use Glide instead of Picasso to increase Performance, available memory... etc

    Use Glide instead of Picasso to increase Performance, available memory... etc

    Picasso and Glide has almost same methods (especially method names!), but Glide use RGB_565 so save image memory.

    check out this document and publish new version.

    thanks to nice library!

    opened by WindSekirun 2
  • Bug when orientation is changed

    Bug when orientation is changed

    Steps to reproduce:

    1. Select any album
    2. Select any image(s)
    3. Change orientation from portrait to landscape or vice versa
    4. Press ADD

    A new instance of AlbumSelectActivity opens. This is one of a few ways of reproducing this bug. It occurs only when there is an orientation change on using the library. Log reads:

    Duplicate finish request for ActivityRecord{1579d8c u0 com.darsh.example.sample/com.darsh.multipleimageselect.activities.AlbumSelectActivity t1162 f}
    

    Bug occured in commit 09bf41c on altering permission request logic.

    Temporary fix: Use any of the released versions of library or any commit on or before commit 088585b.

    bug 
    opened by darsh2 1
  • Better remove app_name from the library

    Better remove app_name from the library

    The library shouldn't really have an app_name. If the main app has an app_name defined (with the same string in the default values), it is overwritten for the other languages by the library.

    opened by markini 1
  • Is it possible to stop user to select images more than limit

    Is it possible to stop user to select images more than limit

    Hi darsh,

    For now, we have an option to set a limit for user image selection. In this case, user can select no of images more than limit but toast show to user to unselect images that are more than limit but I want to make user unable to select images more than limit. Is it possible?

    thanks..

    opened by ahmadplero 1
  • Use Glide instead of Picasso to increase Performance, available memory... etc

    Use Glide instead of Picasso to increase Performance, available memory... etc

    ++ Edit: 2015.07.09: Change target branch master -> develop (based recent develop branch, can automatically merge!)

    Picasso and Glide has almost same methods (especially method names!), but Glide use RGB_565 so save image memory.

    check out this document and publish new version.

    thanks to nice library!

    opened by WindSekirun 1
  • Not working on android SDK 30 and above

    Not working on android SDK 30 and above

    In the latest version its not working at all its throws a

    ##android:exported needs to be explicitly specified for element <activity#com.darsh.multipleimageselect.activities.ImageSelectActivity>. Apps targeting Android 12 and higher are required to specify an explicit value for android:exported when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details.

    opened by wrteam-vimal 1
  • Fatal Exception: java.lang.IllegalArgumentException Volume external_primary not found

    Fatal Exception: java.lang.IllegalArgumentException Volume external_primary not found

    Hello,

    I am getting following issue after i change my target version to 30 (older version is 29),

    com.kolonishare.AlbumSelectActivity$AlbumLoaderRunnable.run (AlbumSelectActivity.java:248) java.lang.Thread.run (Thread.java:923)

    Issue in following code :

      Cursor cursor = getApplicationContext().getContentResolver()
                    .query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, projection,
                            null, null, MediaStore.Images.Media.DATE_ADDED);
    

    I tried with following code but it not help me. (by using MediaStore.VOLUME_EXTERNAL_PRIMARY)

      Cursor cursor = getApplicationContext().getContentResolver()
                    .query(MediaStore.Images.Media.getContentUri(MediaStore.VOLUME_EXTERNAL_PRIMARY), projection,
                            null, null, MediaStore.Images.Media.DATE_ADDED);
    

    Please can you update your code after solving this issue.

    opened by niravtopsy 0
  • java.lang.IllegalArgumentException: the bind value at index 1 is null

    java.lang.IllegalArgumentException: the bind value at index 1 is null

    java.lang.IllegalArgumentException: the bind value at index 1 is null at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:172) at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:142) at android.content.ContentProviderProxy.query(ContentProviderNative.java:472) at android.content.ContentResolver.query(ContentResolver.java:1201) at android.content.ContentResolver.query(ContentResolver.java:1127) at android.content.ContentResolver.query(ContentResolver.java:1083) at com.darsh.multipleimageselect.activities.ImageSelectActivity$ImageLoaderRunnable.run(ImageSelectActivity.java:439) at java.lang.Thread.run(Thread.java:923)

    opened by happyer2018 1
  • library dead?

    library dead?

    so this library is dead? Please remove it from github then.

    Your app badly needs library upgrades:

    +--- com.github.darsh2:MultipleImageSelect:v0.0.4 | +--- com.github.bumptech.glide:glide:3.6.0 -> 4.11.0 | | +--- com.github.bumptech.glide:gifdecoder:4.11.0 | | | --- androidx.annotation:annotation:1.0.0 -> 1.1.0 | | +--- com.github.bumptech.glide:disklrucache:4.11.0 | | +--- com.github.bumptech.glide:annotations:4.11.0 | | +--- androidx.fragment:fragment:1.0.0 -> 1.1.0 () | | +--- androidx.vectordrawable:vectordrawable-animated:1.0.0 -> 1.1.0 () | | --- androidx.exifinterface:exifinterface:1.0.0 | | --- androidx.annotation:annotation:1.0.0 -> 1.1.0 | --- androidx.appcompat:appcompat:1.0.0 -> 1.1.0 (*)

    especially Glide should be using version 4.11 by now. Thanks.

    opened by taar1 5
  • App Crash in Android 9

    App Crash in Android 9

    Process: com.globaldream.property, PID: 12742 java.lang.NoSuchMethodError: No virtual method load(Ljava/lang/String;)Lcom/bumptech/glide/DrawableTypeRequest; in class Lcom/bumptech/glide/RequestManager; or its super classes (declaration of 'com.bumptech.glide.RequestManager' appears in /data/app/com.globaldream.property-zdeA40596EJysgc7gxpvCQ==/split_lib_dependencies_apk.apk) at com.darsh.multipleimageselect.adapters.CustomAlbumSelectAdapter.getView(CustomAlbumSelectAdapter.java:44) at android.widget.AbsListView.obtainView(AbsListView.java:2399) at android.widget.GridView.onMeasure(GridView.java:1070) at android.view.View.measure(View.java:23181) at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:715) at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:461) at android.view.View.measure(View.java:23181) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6749) at android.widget.FrameLayout.onMeasure(FrameLayout.java:185) at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:143) at android.view.View.measure(View.java:23181) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6749) at android.widget.FrameLayout.onMeasure(FrameLayout.java:185) at android.view.View.measure(View.java:23181) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6749) at android.widget.FrameLayout.onMeasure(FrameLayout.java:185) at android.view.View.measure(View.java:23181) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6749) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1535) at android.widget.LinearLayout.measureVertical(LinearLayout.java:825) at android.widget.LinearLayout.onMeasure(LinearLayout.java:704) at android.view.View.measure(View.java:23181) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6749) at android.widget.FrameLayout.onMeasure(FrameLayout.java:185) at com.android.internal.policy.DecorView.onMeasure(DecorView.java:716) at android.view.View.measure(View.java:23181) at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2727) at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1580) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1864) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1468) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7208) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1004) at android.view.Choreographer.doCallbacks(Choreographer.java:816) at android.view.Choreographer.doFrame(Choreographer.java:751) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:990) at android.os.Handler.handleCallback(Handler.java:873) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:6762) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858) 201

    opened by jogigouda 1
Releases(v0.0.4)
Owner
Darshan Dorai
Android developer. Additionally an active participant in programming contests.
Darshan Dorai
card.io provides fast, easy credit card scanning in mobile apps

card.io SDK for Android card.io provides fast, easy credit card scanning in mobile apps. Stay up to date Please be sure to keep your app up to date wi

card.io 2k Jan 1, 2023
Android Weather Library: android weather lib to develop weather based app fast and easily

WeatherLib Android weather lib is an android weather aggregator. The lib helps you getting weather data from the most importat weather provider. It su

Surviving with android (by Francesco Azzola) 641 Dec 23, 2022
Library for Android In-App Billing (Version 3+)

Checkout (Android In-App Billing Library) Description Checkout is an implementation of Android In-App Billing API (v3+). Its main goal is to make inte

Sergey Solovyev 1k Nov 26, 2022
Donations library for Android. Supports Google Play Store, Flattr, PayPal, and Bitcoin

Android Donations Lib Android Donations Lib supports donations by Google Play Store, Flattr, PayPal, and Bitcoin. It is used in projects, such as Open

Sufficiently Secure 346 Jan 8, 2023
A clustering library for the Google Maps Android API v2

DEPRECATED Don't use this. The Maps v3 SDK handles markers. That with a few other cool utilities make this library obsolete! Clusterkraf A clustering

Ticketmaster Mobile Studio 258 Nov 28, 2022
Donations library for Android. Supports Google Play Store, Flattr, PayPal, and Bitcoin

Android Donations Lib Android Donations Lib supports donations by Google Play Store, Flattr, PayPal, and Bitcoin. It is used in projects, such as Open

Sufficiently Secure 345 Dec 21, 2022
Small library that wraps Google Play Service API in brilliant RxJava Observables reducing boilerplate to minimum.

ReactiveLocation library for Android Small library that wraps Google Play Services API in brilliant RxJava Observables reducing boilerplate to minimum

MichaƂ Charmas 2.1k Dec 4, 2022
this is the demo of billing new library v3

Billing library v3 demo android This is the demo of billing new library v3 for android native IMPORTANT 1- you must have login to google play store to

Muhammad Sikandar 3 Dec 6, 2021
Sdk-android - SnapOdds Android SDK

Documentation For the full API documentation go to https://snapodds.github.io/sd

Snapodds 0 Jan 30, 2022
AWS SDK for Android. For more information, see our web site:

AWS SDK for Android For new projects, we recommend interacting with AWS using the Amplify Framework. The AWS SDK for Android is a collection of low-le

AWS Amplify 976 Dec 29, 2022
Accept PayPal and credit cards in your Android app

Important: PayPal Mobile SDKs are Deprecated. The APIs powering them will remain operational long enough for merchants to migrate, but the SDKs themse

PayPal 802 Dec 22, 2022
Powerful custom Android Camera with granular control over the video quality and filesize, restricting recordings to landscape only.

LandscapeVideoCamera Highly flexible Android Camera which offers granular control over the video quality and filesize, while restricting recordings to

Jeroen Mols 1.2k Dec 29, 2022
Countly Product Analytics Android SDK

Countly Android SDK We're hiring: Countly is looking for Android SDK developers, full stack devs, devops and growth hackers (remote work). Click this

Countly Team 648 Dec 23, 2022
Android Real Time Chat & Messaging SDK

Android Chat SDK Overview Applozic brings real-time engagement with chat, video, and voice to your web, mobile, and conversational apps. We power emer

Applozic 659 May 14, 2022
Evernote SDK for Android

Evernote SDK for Android version 2.0.0-RC4 Evernote API version 1.25 Overview This SDK wraps the Evernote Cloud API and provides OAuth authentication

Evernote 424 Dec 9, 2022
SocialAuth repository which contains socialauth android version and samples

SocialAuth Android is an Android version of popular SocialAuth Java library. Now you do not need to integrate multiple SDKs if you want to integrate y

3Pillar Global Open Source 318 Dec 30, 2022
Air Native Extension (iOS and Android) for the Facebook mobile SDK

Air Native Extension for Facebook (iOS + Android) This is an AIR Native Extension for the Facebook SDK on iOS and Android. It has been developed by Fr

Freshplanet 219 Nov 25, 2022
Microsoft Services SDKs for Android produced by MS Open Tech.

Important: This preview SDK has been deprecated and is no longer being maintained. We recommend that you use Microsoft Graph and the associated Micros

Office Developer 222 Dec 1, 2022