Reuse default Android image gallery?

All the examples I found online to display image galleries require creating a custom adapter and doing a ton of manual work. Is there any intention that I can simply pass the path or filter to reuse the functionality of the default image gallery (display thumbnails, tap to view the full pic, sharing options, etc.), but limit the results in my directory application storage?

+4
source share
2 answers
  • Gallery application does not have permission to access files in the directory of your application.

  • Gallery is not part of the Android operating system.

  • The Gallery app is regularly replaced by device manufacturers with their own implementations, so even if you find some damn back door for the regular Gallery app that turned it on, it probably won't work on many devices.

  • Android itself, in an open source project, has two Gallery applications (Gallery and Gallery3D), and I don’t know which ones are necessarily on any device (if any), or just the one that, in your opinion, provides " default image gallery functionality. "

However, those Gallery apps are open source, so you can copy whatever code you like.

+5
source

You can use this code to launch the gallery. Code for video:

Intent intent = new Intent(); intent.setType("video/*"); intent.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult(Intent.createChooser(intent, "Select Video"), 666); 

code for image

  Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult(Intent.createChooser(intent, "Select Video"), 666); 

And after receiving the form in the gallery, you can do whatever you want from it. Make a message if you need to ask anything else. Thanks

+1
source

All Articles