Android Utililty Methods File Name Create

List of utility methods to do File Name Create

Description

The list of methods to do File Name Create are organized into topic(s).

Method

StringmakeFileName(String prefix, String filename)
Makes a 'standard' helper file name.
FastStringBuffer sb = null;
if (filename != null) {
    String[] parts = filename.split("[/|\\\\]");
    sb = new FastStringBuffer(prefix);
    for (int i = 0; i < parts.length; i++) {
        if ((i == 0 && parts.length == 1) || i > 0) {
            sb.append(parts[i]);
return sb == null ? null : sb.toString();
StringcreateImageName()
create Image Name
SimpleDateFormat dateFormat = new SimpleDateFormat(
        "yyyyMMdd_HHmmss");
return "IMG"
        + dateFormat.format(new Date(System.currentTimeMillis()))
        + ".jpg";
StringgetLocalDateTimeForFileName(Date date)
Return current date time as a concatenated string, to be used as filename.
final SimpleDateFormat sdf = new SimpleDateFormat("MMddyyyy_HHmmss");
sdf.setTimeZone(TimeZone.getDefault());
return sdf.format(date);
StringgetJpegFileName(long fileNumber)
get Jpeg File Name
return String.format("%s%016x%s", FILE_PREFIX, fileNumber,
        JPEG_SUFFIX);
StringgetMetadataFileName(long fileNumber)
get Metadata File Name
return String.format("%s%016x%s", FILE_PREFIX, fileNumber,
        METADATA_SUFFIX);
StringgetYuvFileName(long fileNumber)
get Yuv File Name
return String.format("%s%016x%s", FILE_PREFIX, fileNumber,
        YUV_SUFFIX);