I need to capture an image from the camera and I need to do it from inside a Fragment. My problem is that onActivityResult is never called. Below is my code:
private void dispatchTakePictureIntent(){
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(intent, REQUEST_IMAGE_CAPTURE);
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data){
if (requestCode == REQUEST_IMAGE_CAPTURE && resultCode == Activity.RESULT_OK) {
Bundle extras = data.getExtras();
Bitmap imageBitmap = (Bitmap) extras.get("data");
im.setImageBitmap(imageBitmap);
}
Log.e(TAG,"hello");
super.onActivityResult(requestCode, resultCode, data);
}
I have looked up several threads here on this forum but none of them are working for me.