此答案取自here,Shade找到了答案。
File sdCard = Environment.getExternalStorageDirectory();
File dir = new File (sdcard.getAbsolutePath() + "/dir1/dir2");
dir.mkdirs();
File file = new File(dir, "filename");
FileOutputStream f = new FileOutputStream(file);
...
如果您有敏感数据并希望将其保存到内部存储空间,则可以按照this教程进行操作。