Check if device has a camera?

This is what I’m using import android.content.pm.PackageManager; PackageManager pm = context.getPackageManager(); if (pm.hasSystemFeature(PackageManager.FEATURE_CAMERA)) { } All sorts of other fun things to test for are available too – the compass, is location available, is there a front facing camera: http://developer.android.com/reference/android/content/pm/PackageManager.html

Custom camera android

Use this code PreviewDemo.java public class PreviewDemo extends Activity implements OnClickListener { private SurfaceView preview = null; private SurfaceHolder previewHolder = null; private Camera camera = null; private boolean inPreview = false; ImageView image; Bitmap bmp, itembmp; static Bitmap mutableBitmap; PointF start = new PointF(); PointF mid = new PointF(); float oldDist = 1f; File … Read more

Upload an Image from camera or gallery in WebView

After struggling a lot I found a code that works for taking files from galley and camera from 5.0+ devices private ValueCallback<Uri> mUploadMessage; private Uri mCapturedImageURI = null; private ValueCallback<Uri[]> mFilePathCallback; private String mCameraPhotoPath; private static final int INPUT_FILE_REQUEST_CODE = 1; private static final int FILECHOOSER_RESULTCODE = 1; private File createImageFile() throws IOException { // … Read more

Android camera rotate

if (this.getResources().getConfiguration().orientation != Configuration.ORIENTATION_LANDSCAPE) { camera.setDisplayOrientation(90); lp.height = previewSurfaceHeight; lp.width = (int) (previewSurfaceHeight / aspect); } else { camera.setDisplayOrientation(0); lp.width = previewSurfaceWidth; lp.height = (int) (previewSurfaceWidth / aspect); }