Android examples for Camera:Photo
get Photo File name
//package com.java2s; import java.io.File; import java.io.IOException; import java.text.SimpleDateFormat; import java.util.Calendar; import android.os.Environment; public class Main { public static String PHOTO_FILE_NAME; private static final String JPEG_FILE_SUFFIX = ".jpg"; public static File getPhotoFile() throws IOException { String filePath = Environment.getExternalStorageDirectory() .getPath();//from w ww .j a v a 2 s . com Calendar c = Calendar.getInstance(); SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd_HHmmss"); String currentDateandTime = sdf.format(c.getTime()); String fileName = "image_" + currentDateandTime + JPEG_FILE_SUFFIX; PHOTO_FILE_NAME = fileName; File tempFile = new File(filePath, fileName); return tempFile; } }