录制音频的文件名
Filename of recorded audio
我可以录音。但我希望文件名是当前日期和时间。
这是我的代码:
FILE = Environment.getExternalStorageDirectory().getAbsolutePath();
FILE = FILE + File.separator + "Audio/" + System.currentTimeMillis() + ".wav";
System.out.println("Audio path:" + FILE);
试试这个
SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date now = new Date();
String strDate = sdfDate.format(now);
FILE = Environment.getExternalStorageDirectory().getAbsolutePath();
FILE = FILE + File.separator + "Audio/" + strDate + ".wav";
System.out.println("Audio path:" + FILE);
您可以根据需要修改格式。
我可以录音。但我希望文件名是当前日期和时间。
这是我的代码:
FILE = Environment.getExternalStorageDirectory().getAbsolutePath();
FILE = FILE + File.separator + "Audio/" + System.currentTimeMillis() + ".wav";
System.out.println("Audio path:" + FILE);
试试这个
SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date now = new Date();
String strDate = sdfDate.format(now);
FILE = Environment.getExternalStorageDirectory().getAbsolutePath();
FILE = FILE + File.separator + "Audio/" + strDate + ".wav";
System.out.println("Audio path:" + FILE);
您可以根据需要修改格式。