Created
February 6, 2017 16:20
-
-
Save quiro91/71a05e26c6cf848ca4aaaaf4bf6fddd4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void takePicture() { | |
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); | |
if (takePictureIntent.resolveActivity(getPackageManager()) != null) { | |
File photoFile = null; | |
try { | |
photoFile = createImageFileWith(); | |
} catch (IOException ex) { | |
Log.e("TakePicture", ex.getMessage()); | |
} | |
if (photoFile != null) { | |
path = photoFile.getAbsolutePath(); | |
Uri photoURI = Uri.fromFile(photoFile); | |
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoURI); | |
startActivityForResult(takePictureIntent, PHOTO_REQUEST_CODE); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment