在sdcard0和sdcard1 android中保存文件

时间:2016-04-04 02:17:08

标签: android android-sdcard

我想让用户选择将视频文件存储在sdcard0(内部存储器)或sdcard1中。我怎样才能做到这一点。 Environment.getExternalStorageDirectory()和Environment.getExternalPublicStorageDirectory()将文件保存在sdcard1中。如何在sdcard0中保存文件?

2 个答案:

答案 0 :(得分:0)

试试此代码

p = re.compile('data-reveal=*')

答案 1 :(得分:0)

   ContextWrapper contextWrapper = new ContextWrapper(
                getApplicationContext());
        File directory = contextWrapper.getDir(filepath,Context.MODE_PRIVATE);
        myInternalFile = new File(directory, filename);
try {
            FileOutputStream fos = new FileOutputStream(myInternalFile); // save
            fos.write(myInputText.getText().toString().getBytes());
            fos.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
        myInputText.setText("");
        responseText.setText("Saved to Internal Storage.(StorageFile.txt)");