Skip to content

Instantly share code, notes, and snippets.

@snadjafi
Created May 31, 2014 22:02
Show Gist options
  • Save snadjafi/682892fe8890054a6a65 to your computer and use it in GitHub Desktop.
Save snadjafi/682892fe8890054a6a65 to your computer and use it in GitHub Desktop.
start camera actvity
Intent imageIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
String filePath = Environment.getExternalStoragePublicDirectory(
Environment.DIRECTORY_DCIM).toString()+"/Camera";
File rootFolder = new File(filePath);
File image = new File(rootFolder, "bp_" + timeStamp + ".png");
Uri uriSavedImage = Uri.fromFile(image);
imageIntent.putExtra(MediaStore.EXTRA_OUTPUT, uriSavedImage);
startActivityForResult(imageIntent, CAMERA_PIC_REQUEST);
// save image to gallery
// MediaStore.Images.Media.insertImage(getContentResolver(), b, Shot, NAME);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment