Here you can find the source of getOutputMediaFile(Context context)
private static File getOutputMediaFile(Context context)
//package com.java2s; import android.content.Context; import android.os.Environment; import java.io.File; import java.text.SimpleDateFormat; import java.util.Date; public class Main { private static File getOutputMediaFile(Context context) { File mediaStorageDir = Environment .getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES); // Create the storage directory if it does not exist if (!mediaStorageDir.exists()) { if (!mediaStorageDir.mkdirs()) { return null; }/*ww w.jav a 2 s . co m*/ } // Create a media file name String timeStamp = new SimpleDateFormat("ddMMyyyy_HHmm") .format(new Date()); File mediaFile; String mImageName = "TCG_" + timeStamp + ".jpg"; mediaFile = new File(mediaStorageDir.getPath() + File.separator + mImageName); return mediaFile; } }