3

I've just written an app with a nice photo gallery for iOS, now I'd like to do the same thing with my Android version of the app. I see that the Android Gallery API allows me to build a scrolling gallery of images. But what I really want is an apple-photo gallery style interface with a grid of thumbnails which, when tapped, open up a full screen display of the selected image and allows me to navigate through the photo gallery using swipes or left/right arrows on a tool bar.

In iOS I used the KTPhotoBrowser to achieve this interface, but I haven't been able to find anything like that for Android. Can anybody point me to a library, or even a tutorial with example code which will give me an interface like that without having to roll it myself?

Update: I've found the GridView Tutorial which describes how to put image thumbnails into a grid, seems to be the perfect thing. The Gallery API can be used for the full size photo browser as shown in @ariefbayu sample code (see link in comments below). It's not quite the same as the iPhone style gallery, but it's pretty good.

Alan Moore
  • 6,525
  • 6
  • 55
  • 68

1 Answers1

6

I've done this kind of interface. The basic is:

  1. MainActivity load images into GridView.
  2. On each Gallery click, load another activity using Intent, called SlideActivity which extends 'Gallery' in full screen mode where this will:
    1. show Gallery and set current image to selected
    2. set currently selected image in gallery, to what is clicked in first layout.

Link to sample code: https://www.dropbox.com/s/xk2oupma8zcxqpf/GridToGallery.zip

ariefbayu
  • 21,849
  • 12
  • 71
  • 92
  • Sounds promising thanks. I'll take a look at those, I haven't used GridLayout or SlideActivity before. – Alan Moore Jun 10 '12 at 00:22
  • SlideActivity is custom Activity to contain Gallery view. – ariefbayu Jun 10 '12 at 00:28
  • 1
    That sounds perfect for my application. After I have a chance to try it out I'll decide who gets the check mark, thanks for the help. – Alan Moore Jun 10 '12 at 04:27
  • Can you provide a link to SlideActivity - I've been googling it and not finding anything, does this really exist in Android API? – Alan Moore Jun 14 '12 at 17:20
  • 1
    Although your answer did give me some clues, I'm afraid it is inaccurate and has no links or code to back it up so I'm removing the check mark until you either improve the answer or someone else comes up with a proper answer. – Alan Moore Jun 14 '12 at 22:19
  • ahaha, you need actual code? ok, I created one, for you. Try it: http://dl.dropbox.com/u/1636195/GridToGallery.zip – ariefbayu Jun 15 '12 at 08:11
  • Thanks, that is a nice piece of sample code -- however its pretty different from what you gave as your answer. You are using GridView and Gallery which is basically what I had come to as well. If you will be so kind as to update your answer for the sake of others who might want to know, I will be happy to restore your checkmark. – Alan Moore Jun 15 '12 at 13:43
  • 1
    Ups, you are right. However, I saw that you already update the answer. So, no more edit from me. – ariefbayu Jun 17 '12 at 00:42
  • File not found. Link is broken – brunoramonalmeida Jul 15 '17 at 19:33
  • @brunoramonalmeida link fixed. mind you that this a 5 years old codes – ariefbayu Jul 16 '17 at 02:07