Here you can find the source of pickNcapture(Activity activity, Uri outputFileUri)
public static void pickNcapture(Activity activity, Uri outputFileUri)
//package com.java2s; import android.app.Activity; import android.content.Intent; import android.net.Uri; import android.provider.MediaStore; public class Main { public static int PICKnCAPTURE_REQUEST_CODE = 1402; public static void pickNcapture(Activity activity, Uri outputFileUri) {//from w w w . j ava 2 s. c o m Intent pickIntent = new Intent(); pickIntent.setType("image/*"); pickIntent.setAction(Intent.ACTION_GET_CONTENT); Intent takePhotoIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); takePhotoIntent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri); String pickTitle = "Select or take a new Picture"; Intent chooserIntent = Intent.createChooser(pickIntent, pickTitle); chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, new Intent[] { takePhotoIntent }); activity.startActivityForResult(chooserIntent, PICKnCAPTURE_REQUEST_CODE); } }