【问题标题】:Give a specific predefined name when saving audio files in Android在 Android 中保存音频文件时提供特定的预定义名称
【发布时间】:2015-04-18 15:42:06
【问题描述】:

如何使用预定义名称(例如 myfile_date.mp4)将文件保存到外部存储?

【问题讨论】:

  • 使用 Java 文件 I/O。换句话说,请更具体地说明您的问题的性质。

标签: android file save


【解决方案1】:

对于外部存储,我们用基本的智能做这样的事情..:

private String getFilename()
    {
        String timeStamp = new SimpleDateFormat("ddMMYYYY").format(new Date());
        String MySound = "MySound";
        String DefinedName = MySound+timeStamp;


filepath = Environment.getExternalStorageDirectory().getPath();
file = new File(filepath,AUDIO_RECORDER_FOLDER);

if(!file.exists()){
    file.mkdirs();
}

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

}

【讨论】:

    猜你喜欢
    • 2014-11-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多