Image gallery with "select folder" option - java

I have installed a number of apps that have their own image gallery functionality (not using another app via intents). The default view is usually a list of the folders in my SD card that contain images (usually with some kind of thumbnail representing the folder), and then when I drill down into one of these folders they display the thumbs of the images that the folder contains.
Is the folder list part of the MediaStore api, or are the developers doing this manually (query the file system for a list of folders, scan files in folder for common image extensions, etc)? The tutorials I'm finding online for creating an image gallery using the MediaStore api usually just query the whole SD card and fill a GridView with a Cursor returned from managedQuery. Are there better tutorials and documentation for making a custom image gallery?

Related

Move a picture from my app storage to DCIM or Pictures directory on android 10+

I want to move a file say randompic.png to DCIM or Pictures directory so that user does not loose the file after uninstalling the app. I don't want to use LegacyStorage. I've search many times and tried many fix but I wasn't able to move the files. How to do this with ConentResolver and MediaStore api?

How to store pictures in same app like gallery after taking pictures with custom camera In android

I have made custom camera and want to store images in same application instead of built-in gallery.I am taking pictures with my custom camera and want to make separate gallery for that application. A small thumbnail should appear on corner after taking the pictures then on clicking thumbnail it should open my custom galley. So far i have made custom camera which is taking pictures and videos now i want to store them in separate gallery. Please help me out how can i do this task and share your code if you have done already. Your help will be appreciated
You can learn about android file storage management using this link.
Android File Storage. You can read here about differences between Internal storage(Private Location) and external storage(Public location) .
Data Storage Internal/External
As you are not very clear with the description, so there can be 2 possibilities
You want a private location for your images with no other app can access. Private location has benefit that data which you save in this location is app specific. But at the same time you'll also be not able to access the images from file explorer.
You want a public location for your images but a specific place where only your app images are available. Public location has benefit that data (files, images) which you save can be publicly accessible via file explorer, at the same time it can be accessed by other apps in your phone which are granted storage permission.
Saving file in Internal Storage (Private location for app)
Hope this helps and resolves your query.

Load thumbnails for video - JavaFx

In JavaFx we can load images easily from an external server:
imageView.setImage(new Image("http://...File.png"));
But is there a way to load the thumbnail of videos?
Something like: imageView.setImage(new Image("http://...File.mp4"));
I'm developing something like a "gallery" and would like to load the thumbnails of videos coming straight from my server, is it possible?
An mp3 or mp4 file can have an embedded thumbnail image as part of its metadata. There are third party libraries for reading mp3 / mp4 metadata. For example:
How to retrieve thumbnail picture of an mp3 file using java
App Engine Java - Extract thumbnail from mp4 video
If the file doesn't have a thumbnail, then you could conceivably pick a frame of the video and use it as a thumbnail, but the chances of picking an appropriate frame (i.e. one that is indicative of the movie) without the assistance of a human being are not great. But here is an example:
Extract Thumbnail for specific second from MP4 file in Android
But how do you make a video that is not local without downloading it altogether?
Approach #1: pick a 3rd-party metadata extraction library that can operate in stream mode. The metadata should be at / near the start of the stream.
Approach #2: get the server to do the extraction, and present you with the thumbnail separately from the main video.

How can I open an image saved within the app with the android gallery?

I have a little problem with an app I'm designing. I need to be able to open a high-res image (stored in the assets folder of the project), with the android gallery. I have tried many things, like put it in the drawables folder and retrieving the Uri (which gives Out of Memory error). I need to be able to have that high-res image without any type of compression because the user will need to zoom in a lot.
Any idea is welcome, thank you everyone in advance!
You have to copy your image from assets folder to external memory for the Gallery app being able to display it.
The android application is have a strict restriction of using dynamic memory, it is 16 mb. So if image is larger then at least 15mb trying to load it into memory will undoubtedly encouner with OutOfMemory error.
Use this library https://github.com/davemorrissey/subsampling-scale-image-view , which is designed, as it seems, exactely for your needs. As follows from description, the main concept is to load large images partially, just a part for current displaing.

Hide images from gallery - Show only in own application?

How do I take pictures with the camera and ensure that the taken pictures are only visible from within my own application. ie I don't want the pictures to appear in the gallery app?
EDIT:
Can someone show some code on how to set this path such that when the picture is taken and the user presses save in the camera app, it saves to getFilesDir path ?
How do I take pictures with the camera and ensure that the taken pictures are only visible from within my own application.
Don't store them someplace that is indexed by the MediaScanner. That could be in your application-local file store (e.g., getFilesDir()), or on external storage in a directory that has a .nomedia file.
I have tried storing image as blob in sqlite db, but the image still appears in the gallery
Either you did not store the "image as blob in sqlite db", or the images also existed in the file system somewhere. I am very confident that an "image as blob in sqlite db" did not get indexed.

Categories