问题
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!
回答1:
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
回答2:
Try this...
outputFile="/sdcard/myrecord.3gpp";
来源:https://stackoverflow.com/questions/30661338/how-to-save-an-audio-file-in-internal-storage-android