Use camera flashlight in Android

Every device is a bit different. Samsung especially likes to make things complicated for app developers. On the Galaxy Tab you should be good with: Camera cam; void ledon() { cam = Camera.open(); Parameters params = cam.getParameters(); params.setFlashMode(Parameters.FLASH_MODE_ON); cam.setParameters(params); cam.startPreview(); cam.autoFocus(new AutoFocusCallback() { public void onAutoFocus(boolean success, Camera camera) { } }); } void ledoff() … Read more

How to autofocus Android camera automatically?

For me this worked a treat: //set camera to continually auto-focus Camera.Parameters params = c.getParameters(); //*EDIT*//params.setFocusMode(“continuous-picture”); //It is better to use defined constraints as opposed to String, thanks to AbdelHady params.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE); c.setParameters(params);

Android image resizing and preserving EXIF data (orientation, rotation, etc.)

As far as I can tell, there is no mechanism to persist the metadata automatically or even snapshot whatever is there and transfer in bulk. Rather, it seems you must explicitly check for specific properties and copy them yourself to the new image file using the ExifInterface. http://developer.android.com/reference/android/media/ExifInterface.html So something like: ExifInterface oldExif = new … Read more

Controlling the camera to take pictures in portrait doesn’t rotate the final images

The problem is when I saved the image I didn’t do well. @Override public void onPictureTaken(byte[] data, Camera camera) { String timeStamp = new SimpleDateFormat( “yyyyMMdd_HHmmss”).format( new Date( )); output_file_name = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM) + File.separator + timeStamp + “.jpeg”; File pictureFile = new File(output_file_name); if (pictureFile.exists()) { pictureFile.delete(); } try { FileOutputStream fos = new FileOutputStream(pictureFile); … Read more

How to get camera result as a uri in data folder?

There are two ways to solve this problem. 1. Save bitmap which you received from onActivityResult method You can start camera through intent to capture photo using below code Intent cameraIntent=new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); startActivityForResult(cameraIntent, CAMERA_REQUEST); After capture photo, you will get bitmap in onActivityResult method if (requestCode == CAMERA_REQUEST) { Bitmap photo = (Bitmap) data.getExtras().get(“data”); } … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)