Here you can find the source of getOutputMediaFileUri()
public static Uri getOutputMediaFileUri()
//package com.java2s; import android.net.Uri; import android.os.Environment; import android.util.Log; import java.io.File; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static Uri getOutputMediaFileUri() { File mediaStorageDir = new File( Environment// ww w. ja v a 2 s . co m .getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), "MyCameraApp"); if (!mediaStorageDir.exists()) { if (!mediaStorageDir.mkdirs()) { Log.d("MyCameraApp", "failed to create directory"); return null; } } String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss") .format(new Date()); File mediaFile = new File(mediaStorageDir.getPath() + File.separator + "IMG_" + timeStamp + ".jpg"); // L.e(Uri.fromFile(mediaFile).toString()); return Uri.fromFile(mediaFile); } }