Java tutorial
//package com.java2s; //License from project: Apache License import android.app.Activity; import java.io.File; public class Main { /** * Creates a new File to be used by the picture taken, in the DCIM/bad_camera directory. * @param a Actibity used to create file * @return A File object where the FileOutputStream can write the .jpeg to. */ public static File createNewFile(Activity a) { //Set a new path file based on the current timestamp. //We keep in milliseconds in case we take multiple photos within a one second window. Long tsLong = System.currentTimeMillis(); String file = tsLong.toString() + ".jpg"; return new File(a.getExternalFilesDir(null), file); } }