Java tutorial
//package com.java2s; import android.content.Context; import java.io.File; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String cacheCampareImage = "live"; public static File getOutputMediaFile(Context mContext) { File mediaStorageDir = mContext.getExternalFilesDir(cacheCampareImage); if (!mediaStorageDir.exists()) { if (!mediaStorageDir.mkdirs()) { return null; } } String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()); File mediaFile; mediaFile = new File(mediaStorageDir.getPath() + File.separator + "IMG_" + timeStamp + ".jpg"); return mediaFile; } }