1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| @Override
public void onClick(View v) {
Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
if (cameraIntent.resolveActivity(getPackageManager()) != null) {
// Create the File where the photo should go
File photoFile = null;
photoFile = createTempFile("AlphaExp.", ".jpeg");
// Continue only if the File was successfully created
if (photoFile != null) {
cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photoFile));
startActivityForResult(cameraIntent, REQUEST_TAKE_PHOTO);
Toast.makeText(PhotoActivity.this, "photofile créé! ", Toast.LENGTH_LONG).show();
}
}
} |
Partager