I'm following this tutorial http://developer.android.com/training/camera/photobasics.html
to capture photos and save them to the external storage.
Images are captured and saved successfully but the image size file is zero bytes.
The strange thing is that I can still open the file with the stock gallery app, but when copying the image file to the PC, I can't open it with any image viewer.
What can be wrong here? I'm testing on a Samsung Galaxy Nexus.
Change the directory to save the captured images and copy the saved image and paste it in another directory in mobile itself.
OK, found what was wrong. I left the phone for a couple of hours and returned to check the files and surprisingly I found them with their proper files.
Not sure what's the reason for this, I tested the same code on a Samsung S3 and it worked fine, maybe this happens on slow old phones like the Galaxy Nexus.
Related
I am working on an Android app which uses the camera intent... I'm working on my Samsung Galaxy S6 which has no SD card. By following the official documentation tutorial, I am able to get the thumbnail version of the photo taken. However, every tutorials I can find to retrieve the full size version includes the use of an external storage (SD card). So my question is : how can I get the full size version of the photo taken when no external storage is available ?
Thanks!
You don't need an SD card to use getExternalStorage(). Have you actually tried using the code on your Galaxy S6? If so, what issue exactly have you encountered?
I'm having problem saving jpg and png images on internal memory on Android Lollipop. I'm using a simple application that download (directly or asynchronously) an image from URL an show it on imageview and than it's possible to save it in the internal memory previous create an album on image gallery. The problem is that download the image, after it show it inside imageview but it does not save in the internal memory. It show that it save a file with the right name inside the new album but the file has 0.00 bytes. The app work fine in kit kat. I'm trying with this sample because I'm running the same problem in another app that, as the sample do, works fine in kit kat and does not in lollipop.
Hi have been using without problems a bitmap conversion to PNG to keep transparency, for some time now. Afterwards sending the stream byte array to other devices.
bmp.compress(CompressFormat.PNG, 100, stream);
This has been working pretty well so far, until I've started testing with a Nexus5 with android 5.0
and a Note 4 with android 4.4.4.
Up to this point I've used several devices (Note 1, Note 2, S3, S4 among others) and with all of them I receive the PNG properly on the Nexus 5.
When I compress with the Note 4 the Nexus 5 can't seem to decode the byte array
Bitmap image = BitmapFactory.decodeByteArray(arr, 0, arr.length);
the image is null.
Other devices that receive that encoded PNG are able to receive and process it with the same code ...
Even if I try to move the PNG to the Nexus I can't open the file on the device, even trying to use the Photos app to see the picture I get the message "Media not found". with PNGs generated on other devices I have no problems at all.
.
I've just tried something else to try to identify the problem... I've used an app to generate a png image (https://play.google.com/store/apps/details?id=com.jun.shop_image_editing_engver&hl=en) and if I generate a PNG on the NOTE 4 I can't open it on the NEXUS, if I generate a PNG on a Note 2 I am able to open it.
Has anybody had any problem like this?
Thanks for the help
EDIT: Just to clarify, other devices can open the image the NOTE 4 generates (the eye below is such an image)
For the image you included in the question, I am seeing an error in the check value of the zlib compressed data. The producer of the image made a mistake, or the data was corrupted in transit. Receivers of the image can choose to be more or less lenient on such errors in the data, so it might display in some cases, but not in others.
I've also came across this issue last week. In my case, generated png from note 4 cannot be displayed by asus zenphone 2. But the same png was fine in Xiaomi mi4.
My solution in this case was changing Bitmap.CompressFormat from PNG to WEBP, as WEBP are also capable of creating transparent image.
I know it just 'curing' the symptoms, not the root problem, but at least its enough for me, hope it will enough for you.
Is there a way to save an image to the camera roll directory directly? I was using CameraRoll.addBitmapData() call but that converts the bitmapData to a JPEG and all transparency is lost. And also, the image is being heavily compressed. So I would like to save a PNG with transparency to the camera roll directory.
I'm using Adobe AIR 3.6 and testing on Android 4.latest on a Google Nexus 7.
So I'm able to save an image to the camera roll successfully! The problem now is the native Android Image Gallery app doesn't recognize any images I put there except if I restart the device. It also has a problem with thumbnails (they show a different image or are simply a black background).
Here's what I found:
DCIM – This folder is for Photos and contains another folder named Camera which contains all of the photos and videos taken by the phone’s camera (Created by the OS)
Download – Will be automatically create as needed for downloaded files. Source
Pictures - Not sure.
What doesn't work
Image Gallery doesn't reflect new images added to the directory until the device is restarted. The thumbnails are also incorrect as I stated above.
I've noticed in the Camera directory there is a .ds_store type of file and another directory for thumbnails. Other directories besides DCIM / Camera do not appear to have this file.
UPDATE
I found out that it's a known issue that the camera roll does not refresh! If it is an AIR only problem or not I don't know. But there is an extension to refresh the image gallery after you add the image. http://extensionsforair.com/extensions/refresh-gallery/. I haven't tried it.
Other posts...
I have successfully converted an image to PDF with the iText library in the android device, Samsung Galaxy Tab. There is no issue in viewing the PDF in Galaxy Tab. But, when I send the generated file via. email and open in it HTC desire or my PC the image is very much enlarged. What could be the issue?
Would anyone please help?
I solved the issue by resizing the image to be converted to pdf, keeping the aspect ratio. This new image was used to create the PDF.