who=null, request=1888, result=-1, data=null
data
is null
, meaning that the intent you recieved from the finishing activity is null
. So calling : data.getExtras()
will cause a NPE.
You have to test first if data is not null, like this :
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == CAMERA_REQUEST && resultCode == RESULT_OK) {
if(data != null) {
Bitmap photo = (Bitmap) data.getExtras().get("data");
imageView.setImageBitmap(photo);
}
}
}
EDIT:
If image is not created, may be it's due to your if
test, meaning that data is still null. You have to set data
values in your finishing activity :
Intent intent = getIntent().putExtra("data", "your data value");
in order to get them back in onActivityResult
method :
data.getExtras().getString("data");