MultipleImagePicker

Additional

Language
Java
Version
N/A
Created
Feb 19, 2015
Updated
Jan 21, 2020 (Retired)
Owner
Cüneyt Çarıkçi (Cutta)
Contributor
Cüneyt Çarıkçi (Cutta)
1
Activity
Badge
Generate
Download
Source code

Advertisement

MultipleImagePicker for Android

Custom Gallery for Single and Multiple image pick

Usage

This project use Universal Image Loader. Firstly your project must be include Universal Image Loader Lib

After that set your AndroidManifest.xml

 <activity android:name="com.cunoraz.pickImages.CustomGalleryActivity" > <intent-filter> <action android:name="cunoraz.ACTION_PICK" /> <action android:name="cunoraz.ACTION_MULTIPLE_PICK" /> 
            &lt;<span class="pl-ent">category</span> <span class="pl-e">android</span><span class="pl-e">:</span><span class="pl-e">name</span>=<span class="pl-s1"><span class="pl-pds">"</span>android.intent.category.DEFAULT<span class="pl-pds">"</span></span> /&gt;
        &lt;/<span class="pl-ent">intent-filter</span>&gt;

</activity>

//Calling galery for multiple image
Intent i = new Intent(Action.ACTION_MULTIPLE_PICK);
startActivityForResult(i, 100);
   
    //Calling galery for multiple image
Intent i = new Intent(Action.ACTION_MULTIPLE_PICK);
startActivityForResult(i, 200);

Overrie your activity's onActivityResult method like this

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
 super.onActivityResult(requestCode, resultCode, data);
    imagePaths = new ArrayList<String>();
 if (requestCode == 100 && resultCode == Activity.RESULT_OK) {
  adapter.clear();

  viewSwitcher.setDisplayedChild(1);
  String single_path = data.getStringExtra("single_path");
        imagePaths.add(single_path);
  imageLoader.displayImage("file://" + single_path, imgSinglePick);

 } else if (requestCode == 200 && resultCode == Activity.RESULT_OK) {
  String[] all_path = data.getStringArrayExtra("all_path");

  ArrayList<CustomGallery> dataT = new ArrayList<CustomGallery>();

  for (String string : all_path) {
   CustomGallery item = new CustomGallery();
   item.sdcardPath = string;
            imagePaths.add(string);
   dataT.add(item);
  }

  viewSwitcher.setDisplayedChild(0);
  adapter.addAll(dataT);
 }
}

SS

<img src = "http://i.imgur.com/OMkJLDN.jpg"

#Credits

License

Copyright 2015 Cüneyt Çarıkçi

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.