Android ACTION_IMAGE_CAPTURE Intent

this is a well documented bug in some versions of android. that is, on google experience builds of android, image capture doesn’t work as documented. what i’ve generally used is something like this in a utilities class. public boolean hasImageCaptureBug() { // list of known devices that have the bug ArrayList<String> devices = new ArrayList<String>(); … Read more

How to save picture to iPhone photo library?

You can use this function: UIImageWriteToSavedPhotosAlbum(UIImage *image, id completionTarget, SEL completionSelector, void *contextInfo); You only need completionTarget, completionSelector and contextInfo if you want to be notified when the UIImage is done saving, otherwise you can pass in nil. See the official documentation for UIImageWriteToSavedPhotosAlbum().

Android – Camera preview is sideways

This issue appeared to start out as a bug with certain hardware see here but can be overcome by using the call to mCamera.setDisplayOrientation(degrees) available in API 8. So this is how I implement it: public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { if (isPreviewRunning) { mCamera.stopPreview(); } Parameters parameters = mCamera.getParameters(); … Read more

How do I open the “front camera” on the Android platform?

private Camera openFrontFacingCameraGingerbread() { int cameraCount = 0; Camera cam = null; Camera.CameraInfo cameraInfo = new Camera.CameraInfo(); cameraCount = Camera.getNumberOfCameras(); for (int camIdx = 0; camIdx < cameraCount; camIdx++) { Camera.getCameraInfo(camIdx, cameraInfo); if (cameraInfo.facing == Camera.CameraInfo.CAMERA_FACING_FRONT) { try { cam = Camera.open(camIdx); } catch (RuntimeException e) { Log.e(TAG, “Camera failed to open: ” + e.getLocalizedMessage()); … Read more

Android Camera Intent: how to get full sized photo?

To get full sized camera image you should point camera to save picture in temporary file, like: private URI mImageUri; Intent intent = new Intent(“android.media.action.IMAGE_CAPTURE”); File photo; try { // place where to store camera taken picture photo = this.createTemporaryFile(“picture”, “.jpg”); photo.delete(); } catch(Exception e) { Log.v(TAG, “Can’t create file to take picture!”); Toast.makeText(activity, “Please … Read more

Why does an image captured using camera intent gets rotated on some devices on Android?

Most phone cameras are landscape, meaning if you take the photo in portrait, the resulting photos will be rotated 90 degrees. In this case, the camera software should populate the Exif data with the orientation that the photo should be viewed in. Note that the below solution depends on the camera software/device manufacturer populating the … Read more

Capture Image from Camera and Display in Activity

Here’s an example activity that will launch the camera app and then retrieve the image and display it. package edu.gvsu.cis.masl.camerademo; import android.app.Activity; import android.content.Intent; import android.graphics.Bitmap; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.ImageView; public class MyCameraActivity extends Activity { private static final int CAMERA_REQUEST = 1888; private ImageView imageView; private static final int MY_CAMERA_PERMISSION_CODE … Read more