Camera pics not appearing in Gallery app - android

When I take pictures using android.hardware.camera and I save them to the following location /sdcard/dcim/camera/ they don't appear when I launch the gallery. Is there a process for getting them to show up in the gallery that I missed?
I can see my images using a file explorer and know they have been saved.

You need to run MediaScanner on the type of media that you have saved to make your changes(SDcard writes) transparent throughout the system.
MediaScanner is bundled with devTools package so you can either run it manually or you can also do it via Java code(right after the write to SDcard op). Google "MediaScanner" you will find plenty of examples.
Hope that helps.

Related

Can we automatically delete images on a device with Flutter?

My Flutter app will be used to capture image then save to device. I want to remove all images in my device at a preset time. Is there a way to do that?
I think it not because if an app can delete all the images in device so it will not safe to use that app but I still hope it have because it needs for my app.
Things are changing with the recent releases of Android. Access to file system is not going to be same. but you are going to save the captured image in a folder where you have write access, there you can delete all the pictures without a problem

Why android gallery doesn't has rename option?

I am developing an app which captures an image and stores it in gallery with a name returned by the currentTimeInMillis() method of java.lang package. For better recognition I want to rename those images but i found there is no rename option in the gallery.
Can anybody is there any issue behind not giving this option.
The gallery application scans the filesystem and shows the pictures as they appear. If you need to change the filename, you can do this with the File.renameTo() method.

Stop images on sd card from showing up in gallery?

I keep some png files on the user's sd card. Some users report that these images are showing up in their gallery application. Sounds like the gallery implementation on some devices search out any image files they can find on the sd card and show it in the gallery. Is there a way to tell the system not to include these images in the gallery? It's just an annoyance to the users.
Thanks
You can hide individual files from the gallery with a . prefix. For example .myimage.png
I'm not sure what version dependencies the above has and it doesn`t work with some third-party picture tools like the Gallery.
You should add a file named .nomedia into the directory where your images are. You may need to eject and re-insert the SD card before the images disappear from gallery (or otherwise trigger the media scanner) after creating this file on a phone that the Gallery has already picked up the files in the Gallery.
I think the .nomedia option is the best solution, although again, third party tools may not respect the .nomedia flag.
Hiding your files from the Media
Scanner Include an empty file named
.nomedia in your external files
directory (note the dot prefix in the
filename). This will prevent Android's
media scanner from reading your media
files and including them in apps like
Gallery or Music.
In http://developer.android.com/guide/topics/data/data-storage.html#filesExternal
You may also consider saving those files as cache files or in the internal memory. More info in that link.
just keep the files in a folder and name the folder starting with a '.'
for example:
Pictures
Videos
.private--> will not be scanned for any media
Eboks
Along with these solutions using picasa is an alternative too... and .nomedia or .foldername suggestions are generally useful but...
Including accepted answer none of the solutions solve album covers problem.
A large number of android users are storing album covers inside the album folder and .dirname or .nomedia solutions are hiding all from both gallery and music player. The required functionality is hiding from gallery and showing in music player (else there is no reason for not deleting cover pics if we will not see them right? )
Here is the solution ;
Rename all album cover picture files to albumart.jpg
(or what picture you desire to hide from gallery)
This way gallery will not include them and music player will still use :)
Alternatively for any folder if you place a folder.jpg file in it that file will be ignored by gallery application.
As you can see we can only exclude max 2 files (pictures) from gallery application, not more :(
After you do this changes no need to clean caches of gallery and media scanner and reboot (still an option) just run an application that triggers scanning of media on every run. I prefer vaulty it refreshes media gallery on every run on photos, but there are lots of apps, maybe you already have one installed , just use it no need to install an application for just this media scan deal.
Knowledge source : http://code.google.com/p/android/issues/detail?id=35879
While making external directory use something like this
File mediaStorageDir = new File(Environment.getExternalStoragePublicDirectory("YourDirectoryName"),"YourFolderName");
Instead of
File mediaStorageDir = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), "YourFolderName");
These files won't be detected by gallery for more reference check saving media files on this link
http://developer.android.com/guide/topics/media/camera.html#intent-receive
Neither Windows nor Android allow the creation of the file .nomedia
It's seen as a file extension without a name.
i tried everything but only this solution worked 100% you need to plug in your urb and format the sdcard check quick format box and press on restore defaults and then it will show everything in ur gallery just you need to move all your images again :)
You can easily create the folder in Windows using Powershell
New-Item -path 'C:\Users\Google Drive\Pictures\.nomedia' -itemtype directory

How to delete photo just taken in android program

I have written a program that uses the Intent for the image capture to get a photo using the application in the phone.
Using MediaStore.EXTRA_OUTPUT, I get a URI to the image, which converted to a path results in something like "/external/images/media/NN" where NN is the number of the photo.
Now, in my program, after I read and manipulated the image, I want to delete that image.
How should I do that?
(File image = new File(path); image.delete(); // returns false, so doesn't work)
Thanks for the answer.
I resolved reading this answer, Problems saving a photo to a file
For me it works on Hero, even if in the comment in that code snipped says that Hero behave differently.
Now I get the image in "/sdcard/image.tmp", and I can delete it.
I think this is the best solution, cause I think it's a trouble trying to get the camera app to write in my app directory.
Thanks again.
Is it possible that you've failed to request the WRITE_EXTERNAL_STORAGE permission in your app? This would cause deletions to fail. (The camera would be able to write regardless, since it is a separate app with its own permissions.)
It's also possible (but not likely) that the media folder is only writable by the camera app, in which case you'd want to specify a different desired destination in the EXTRA_OUTPUT extra of the intent which invokes the camera so that the file will be written into your app's directory. In fact, you probably want to do that anyway to avoid cluttering up the global space with private resources, even if you are going to delete them immediately.

How to put a wallpaper inside an apk file?

I'm planning to release a nice clock widget and I'd like to include a pretty wallpaper with it (want to do this because previously got some comments like "can i get the matching wallpaper? ;)")
So I tried to google on how to put some image file inside apk so that it would appear in wallpapers selection list after installation. I mean the list which appears when doing Home=>Menu=>Wallpaper=>Wallpaper Gallery or Pictures - whatever.
So far didn't find any hints, so decided to try to ask here.
Any hints on how to do that?
You could package the wallpaper in res/raw, and then when your app fires up for the first time, attempt to copy it to the sdcard directory /media/pictures.
You should be using methods such as getExternalStorageDirectory or getExternalStoragePublicDirectory (depending on the API level) to open the file.
http://developer.android.com/guide/topics/data/data-storage.html#filesExternal

Categories

Resources