Android Custom Gallery And Instant Upload Project


Previously I had worked on followings:

  1. Image uploading activity – Blog post
  2. Re size image without loosing EXIF tags – Blog post
  3. Custom image gallery with check box to select multiple – Blog post

So I decided to create an open source project. That satisfy most of the requirement. Project can be integrated to your application.

Features currently achieved are listed here:

  1. Custom gallery with check box to select multiple
  2. View image in gallery
  3. Capture button to take a new image
  4. Automatically added captured image to MediaStore, so that we can use thumbnail generated by OS itself
  5. Added selected images to upload list, where we can add addition information, like comments
  6. Re size image if it is too big. I maintained EXIF tags, while creating a new copy. I used EXIFInterface, introduced in API level 5. So Project is fully compatible with min SDK version 2.1. (Note. EXIFInterface can only read some of the tags, for complete EXIF tag copy, refer to Sanselan project. My this post can help you how to use it.)
  7. Used URlConnection object to write file using buffer. It also maintain EXIF tags when you receive file on server

Upcoming features:

  1. Upload to facebook, picasa or any other API integration
  2. Add uploading process to Android Notification area

Please feel free to comment.

Project is hosted at Github.
Download source code from github.


52 thoughts on “Android Custom Gallery And Instant Upload Project

  1. Hi am building app in which i have to load 3X3 images into gridview and it should scroll horizotally to see other images in 3X3 format .plase help

    1. hey vikas,
      i need your help in this code. I implemented this code in my application with some UI modifications. Now i want to send these images to my server as a multipart format.
      in URL=new URL(my server url);
      now i want to send access token, images and image name to my server. so will you please guide me in this.
      and what actually
      private static final String LINE_START = “–“;
      private static final String LINE_END = “\r\n”;
      private static final String BOUNDRY = “*****”;
      these three variables do in project.
      suggest me to complete this as early as possible.

    1. Building a fresh project around your java classes and resources works. I can give you a complete project if you like. Next problem is that the upload always fails with the “try again” message.

      1. It fails with an operation timed-out SocketException on the line
        dos = new DataOutputStream(conn.getOutputStream());
        Reply via email and I can send you the project.

  2. Hi Vikas,
    Really you have done a great job. Well I had liked to ask you something related to my work. Actually I m trying to select multiple contacts and send them to the server.
    Can you suggest me some tips for this.
    thanks in advance

  3. Hi Vikas,
    This is what I was looking for. Very nicely done. I am new to creating REST service. I was wondering if you can post some code of the service which receives the images and saves to database. I am just looking for how to consume the sent image data in service.


  4. Thank you very much for your share!!!
    However, could you provide some PHP code with the project? For example, ”
    url = new URL( getString(R.string.WebServiceURL) + “/cfc/iphonewebservice.cfc?method=uploadPhoto&returnformat=json”);”
    This code is on your project but I want to try it myself.

  5. Very nice app. I noticed that you also make blackberry apps. Ever tried this on the playbook? Ran it there – the capture store didn’t seem to work so well (it captures an image but didn’t seem to have a hand-off back to the original activity that it was done). But everything else seem to work fine there.

    1. Most of the andorid mobile support this feature in camera application. What you need to do is, go to the camera and then go to the settings and find settings about add GPS location to picture.

      1. ya thats setting comes nearly in every smartphone,but my point is to how can i upload an image with these information?

  6. Thanks a lot.. nd a suggestion…
    Why to load all the thumbnails at time of initialisation …which will increase the heap of app.Rather saving the paths of the thumbnails and generating bitmap dynamically will save a lot of heap.

    Hope this helps out… correct me if am wrong…

  7. Hi,

    How can I add mark all checkbox besides select button?
    So that it will mark all checkboxes in thumbnails and then i can click select so it will select all thumbnails…
    Can you please help me with this ?

  8. I’m getting always an error message saying Description Resource Path Location Type
    Project ‘AndroidImageUpload’ is missing required library: ‘D:\Vikas\Downloads\httpcomponents-client-4.1-beta1-bin-with-dependencies\httpcomponents-client-4.1-beta1\lib\httpmime-4.1-beta1.jar’ AndroidImageUpload Build Path Problem

    Where can I get this library?

    1. Remove that dependency by right click on project -> choose build path -> configure -> and remove the one that gives you error. Sorry for connivance.

      1. if you take this ‘D:\Vikas\Downloads\httpcomponents-client-4.1-beta1-bin-with-dependencies\httpcomponents-client-4.1-beta1\lib\httpmime-4.1-beta1.jar’ away it will result in an error…how can i get a library like that?

  9. Thanks so much for the code. It has helped a lot. From my research it looks like would be a good idea to use a cursorLoader to load the images on a different thread and not use the main thread.

  10. hi vikas i downloaded ur code from github..but i m facing some probem..suppose if i want to upload a image from ur app to my grails server…What changes should i do for this??

  11. First of all thanks for your great code, it’s work like a charm.
    1. How to show pictures from a specific folder not all the sdcard?
    I change the cursor path but it show nothing just a blank screen with two buttons.
    2. Is it possible to enable finger gestures like sweep to change the pictures?

    1. how were you able to fix this problem ‘D:\Vikas\Downloads\httpcomponents-client-4.1-beta1-bin-with-dependencies\httpcomponents-client-4.1-beta1\lib\httpmime-4.1-beta1.jar’?

  12. im trying to run one of your work but i get this ‘D:\Vikas\Downloads\httpcomponents-client-4.1-beta1-bin-with-dependencies\httpcomponents-client-4.1-beta1\lib\httpmime-4.1-beta1.jar’ what should i do?

  13. My previous problem has solved. but it is showing force close now. How to solve this problem .Please help me out.

  14. Hi Vikas! Thanks for the code it really help me alot for my thesis! but i have a question is it possible for the image to be sent to mysql server?
    your response is very much appreciated.

  15. I think there is a problem about app. when ı push the ‘back’ button in app, it has an error and it closes. how can we solve this problem..??

  16. Nice tutorial thanks for this. I implemented this with my project but i want to implement capture image from camera button inside gridview. Like first image is camera image on that click camera intent will be called. Please guide me to do this.

  17. hello Vikas my requirement is to upload multiple photos for a single post.i have used your code but not able to take all the image path in an array for decoding.Will you please help me out?can you just modify your code so that i can upload multiple images for a single post.
    dos.writeBytes(“Content-Disposition: form-data; name=\”file1[”
    + String.valueOf(i++)
    + “]\”;”
    + ” filename=\””
    + uploadPath + “\”” + LINE_END);
    Please Help..
    thank you in advance..
    I have tried but it is uploading all the pictures as different post..

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s