Java tutorial
//package com.java2s; import android.content.Intent; import android.net.Uri; public class Main { public static Uri getfinalUriForCameraOrOtherImages(Intent data, Uri mOutputFileUri) { final boolean isCamera; Uri selectedImageUri = null; if (data == null || data.getData() == null) { isCamera = true; } else { final String action = data.getAction(); if (action == null) { isCamera = false; } else { isCamera = action.equals(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); } } if (isCamera) { selectedImageUri = mOutputFileUri; } else { selectedImageUri = data == null ? null : data.getData(); } return selectedImageUri; } }