If the user cancel the request, the data will be returned as NULL
. The thread will throw a nullPointerException
when you call data.getExtras().get("data");
. I think you just need to add a conditional to check if the data returned is null.
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == CAMERA_REQUEST) {
if (data != null)
{
Bitmap photo = (Bitmap) data.getExtras().get("data");
imageView.setImageBitmap(photo);
}
}