如何在内部存储Android中保存音频文件 [英] How to save an audio file in internal storage android

查看:1313
本文介绍了如何在内部存储Android中保存音频文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何在我的android设备的内部存储中保存音频文件.具体来说,我希望我的应用程序记录麦克风的声音,以将此文件保存在内部存储中.我知道对于外部存储来说,是这样的:

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!

推荐答案

使用 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

这篇关于如何在内部存储Android中保存音频文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆