How to save an audio file in internal storage andr

2019-09-19 03:33发布

I was wondering how can I save an audio file in the Internal storage of my android device. Specifically I would like my app that records sound from the microphone to save this file in the internal storage. I know that for external storage there is something like:

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

Is there anything similar for internal storage also? Thanks!

2条回答
我欲成王,谁敢阻挡
2楼-- · 2019-09-19 04:12

Use 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);

For more see Using the Internal Storage

查看更多
聊天终结者
3楼-- · 2019-09-19 04:13

Try this...

outputFile="/sdcard/myrecord.3gpp";
查看更多
登录 后发表回答