Java tutorial
//package com.java2s; import android.content.ClipData; import android.content.Intent; import android.net.Uri; import android.provider.MediaStore; public class Main { public static Intent getPhotoPickerIntent(Uri photoUri) { Intent captureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); addPhotoPickerExtras(captureIntent, photoUri); return captureIntent; } private static void addPhotoPickerExtras(Intent intent, Uri photoUri) { intent.putExtra(MediaStore.EXTRA_OUTPUT, photoUri); intent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION); intent.setClipData(ClipData.newRawUri(MediaStore.EXTRA_OUTPUT, photoUri)); } }