0
private String getFilename() {
        String filepath = Environment.getExternalStorageDirectory().getPath();
        File file = new File(filepath, AUDIO_RECORDER_FOLDER);
        if (!file.exists()) {
            file.mkdirs();
        }
        return (file.getAbsolutePath() + "/" + System.currentTimeMillis() + file_exts[currentFormat]);
    }

i want to save my file with current date and time formate, as my recorded file is not saving with current date and time format.

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115

1 Answers1

1

Instead of doing this:

return (file.getAbsolutePath() + "/" + System.currentTimeMillis() + file_exts[currentFormat]); 

do this:

String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
 return (file.getAbsolutePath() + "/" + timeStamp + file_exts[currentFormat]); 
Qandeel Abbassi
  • 999
  • 7
  • 31