I am working with capturing an image and then show it on my ImageView in my fragment. I searched this through web and still I cannot make it. Below is what I am doing.
btnCaptureImg.setOnClickListener(new OnClickListener() {
    @Override
    public void onClick(View v) {
        Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); 
        startActivityForResult(cameraIntent, 1888); 
    }
});
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    Log.e("LOG", ""+requestCode);
    if (requestCode == 1888 && resultCode == Activity.RESULT_OK) {  
        Bitmap photo = (Bitmap) data.getExtras().get("data"); 
        imageView.setImageBitmap(photo);
    }
    super.onActivityResult(requestCode, resultCode, data);
}  
The Logcat says 1888 only but the imageView did not load the image.
I also tried this
btnCaptureImg.setOnClickListener(new OnClickListener() {
    @Override
    public void onClick(View v) {
        File folder = new File(Environment.getExternalStorageDirectory().toString()+"/ImagesFolder/");
        folder.mkdirs();
        Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
        resultingFile = new File(folder.toString() + "/image.jpg");
        Uri uriSavedImage=Uri.fromFile(resultingFile);
        cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, uriSavedImage);
        startActivityForResult(cameraIntent, 1888);
    }
});
But it throws exception:
E/AndroidRuntime(4824): java.lang.RuntimeException: Unable to resume activity {com.myapp.android/com.myapp.android.MyHomeActivity}: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=264032, result=-1, data=null} to activity {com.myapp.android/com.myapp.android.MyHomeActivity}: java.lang.NullPointerException
E/AndroidRuntime(4824):     at com.myapp.android.MyFragment.onActivityResult(MyFragment.java:300)
 
     
     
     
    