Android examples for Camera:Camera Feature
create File Name for Camera by Media type
//package com.java2s; import java.io.File; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static int MEDIA_TYPE_IMAGE = 1; static int MEDIA_TYPE_VIDEO = 2; private static File createFile(int type, File mediaStorageDir) // Used to be 'private File ...' {// w w w .ja v a 2s .c o m String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss") .format(new Date()); File mediaFile = null; if (type == MEDIA_TYPE_IMAGE) { mediaFile = new File(mediaStorageDir.getPath() + File.separator + "IMG_" + timeStamp + ".jpg"); } else if (type == MEDIA_TYPE_VIDEO) { mediaFile = new File(mediaStorageDir.getPath() + File.separator + "VID_" + timeStamp + ".mp4"); } return mediaFile; } }