我编写了代码,将用户的答案以及录制的音频片段 (.3gp) 保存到他们的 SD 卡,然后上传到服务器。我知道这可能不是解决此问题的最佳方法,因为用户可能没有 SD 卡。我知道我可以输入代码来检查用户是否有 SD 卡,但这无济于事。是否有另一种方法可以在没有 SD 卡的设备上存储信息或文件,或者有更好的方法来解决这个问题?谢谢您的帮助!
编辑:下面的代码是有效的解决方案
try{
File pathCacheDir = getCacheDir();
System.out.println("Got the Cache directory");
File newCacheFile = new File(pathCacheDir, cacheFileName);
newCacheFile.createNewFile();
FileOutputStream stream = new FileOutputStream (newCacheFile.getAbsolutePath());