How to implement a custom photo gallery of devices for Android?

I am working on an android application that will include the main functions of the image gallery. I managed to create an activity that retrieves a list of photos from my application API and displays them in a gridview in Android.

Here's what it looks like at the moment:
alt text

However, I am having difficulty creating the same gallery experience for photographs of user devices that were taken by the camera and saved on the device. The two solutions that I considered were:

  • Build your own image gallery.
  • Launch the default image gallery for Android using intent.

Solution 1: I believe that the first solution will take too much time to develop. I started with this tutorial , but as soon as I implemented it, I found out that it works too slowly. Then I look at the camera android camera source code to find a solution, but again I found that it would take me too long to view the code and create my own gallery from scratch. I also believe that it is not in the philosophy of Android OS to rewrite existing functions, but to use Intents to trigger actions that can handle the necessary actions. This led me to the second solution.

Solution 2: I tried calling the default Android gallery, using intention to view photos of user devices, I was soon stuck again. The problem this time was that as soon as the user clicks on the photo, the gallery exits and returns to the activity that launched it itself, and I expected (and want) to start a large viewing of the image. I saw that others also had this problem of how to open a gallery using intention with no result . Since I did not find a fix for this, I decided to leave.

My question is how can I overcome these problems and create a gallery similar to the one I already have for web photography. If anyone could give me a link, I would be very grateful.

+7
source share
1 answer

this question is quite old, but since it has a lot of views and quite a lot of reproaches, it would be nice to answer it.

So, at first the tutorials have changed a bit, and you can find cool things for your option # 1 :

  • This is the one I prefer
  • This one uses an obsolete user interface element, but also cool
  • This uses the adapter, which for me is the best way.

For your option # 2, I don’t see any idea not to return to the original action, because you still do not control the result of the intent that you send through the system.

But there is another solution that you did not mention: there are excellent ones that are very cool, and you can configure them exactly the way you want:

  • This one is a little freaky
  • This one also seems pretty cool, but you may have import problems because it is not a gradle project
  • This is the one I would definitely use.
+1
source

All Articles