Android examples for java.io:File
make Temp File
import java.io.File; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; import android.content.Context; public class Main { @SuppressWarnings({ "ConstantConditions", "ResultOfMethodCallIgnored" }) public static File makeTempFile(Context context, String saveDir, String extension) { if (saveDir == null) saveDir = context.getExternalCacheDir().getAbsolutePath(); final String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.getDefault()).format(new Date()); final File dir = new File(saveDir); dir.mkdirs();/*from w w w . j a va 2 s .co m*/ return new File(dir, "VID_" + timeStamp + extension); } }