Skip to content

Instantly share code, notes, and snippets.

@omegasoft7
Created January 9, 2015 13:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save omegasoft7/c5247c2cae6a08c81951 to your computer and use it in GitHub Desktop.
Save omegasoft7/c5247c2cae6a08c81951 to your computer and use it in GitHub Desktop.
Take picture and save it
btn01.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent imageIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
File imagesFolder = new File(Environment.getExternalStorageDirectory(), "MyImages");
imagesFolder.mkdirs(); // <----
File image = new File(imagesFolder, "image_001.jpg");
Uri uriSavedImage = Uri.fromFile(image);
imageIntent.putExtra(MediaStore.EXTRA_OUTPUT, uriSavedImage);
startActivityForResult(imageIntent,0);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment