【问题标题】:How to save an audio file in internal storage android如何在内部存储android中保存音频文件
【发布时间】:2015-06-05 16:04:51
【问题描述】:

我想知道如何将音频文件保存在我的 android 设备的内部存储中。具体来说,我希望我的应用程序可以记录麦克风的声音,以便将此文件保存在内部存储中。我知道对于外部存储有类似的东西:

outputFile = Environment.getExternalStorageDirectory()+"/myrecord.3gpp";

内部存储也有类似的东西吗? 谢谢!

【问题讨论】:

标签: android audio mediarecorder internal-storage


【解决方案1】:

使用 getFilesDir()

SDCardpath = getFilesDir();
    myDataPath = new File(SDCardpath.getAbsolutePath()
            + "/.My Recordings");

    // mydir = context.getDir("media", Context.MODE_PRIVATE);
    if (!myDataPath.exists())
        myDataPath.mkdir();


    audiofile = new File(myDataPath + "/" + fileName);

更多信息请见Using the Internal Storage

【讨论】:

    【解决方案2】:

    试试这个...

    outputFile="/sdcard/myrecord.3gpp";
    

    【讨论】:

    • 他不是说他想要内部存储吗? SD卡是外部的。
    猜你喜欢
    • 2023-03-08
    • 1970-01-01
    • 2018-10-28
    • 1970-01-01
    • 1970-01-01
    • 2012-10-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多