无法创建文件夹中extsd卡文件、夹中、extsd

由网友(徒留一地凄凉。)分享简介:我有一个Android平板电脑,其中外接SD卡叫到/ mnt / extsd,其内部存储所谓的到/ mnt / SD卡。I have an android tablet where external SD card called "/mnt/extsd" and its internal storage called...

我有一个Android平板电脑,其中外接SD卡叫到/ mnt / extsd,其内部存储所谓的到/ mnt / SD卡。

I have an android tablet where external SD card called "/mnt/extsd" and its internal storage called "/mnt/sdcard".

当我试图通过以下code创造到/ mnt / SD卡的文件夹。应用程序根目录下的成功创建文件夹,当我尝试创建文件夹到/ mnt / extsd它敬酒例外打开失败:EACCESS(权限被拒绝)

When I am try to create a folder in "/mnt/sdcard" by the following code. Application successfully creates folder in root directory, while I try to create folder in "/mnt/extsd" it toast an exception "open failed: EACCESS (Permission denied)"

    // create a File object for the parent directory
    File root_directory = new File("/mnt/extsd/abc/");
    // have the object build the directory structure, if needed.
    root_directory.mkdirs();
    // create a File object for the output file
    File outputFile = new File(root_directory, "abc_checking");
    // now attach the OutputStream to the file object, instead of a String representation
    try {
        FileOutputStream fos = new FileOutputStream(outputFile);
    } catch (FileNotFoundException e) {
        // TODO Auto-generated catch block
        Utility.showDialogue(getActivity(), e.getMessage() + "");
    }

清单

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

这是你们任何帮助将是非常美联社preciable。请帮助...:(

Any help from you guys will be very appreciable. Please HELP...:(

推荐答案

如果 Environment.getExternalStorageDirectory()返回到/ mnt / SD卡/ ,那么这就是你应该使用你的应用程序的外部存储。当你的设备可能有其他的挂载点(例如,的/ mnt / extsd / ),这些都不是Android SDK的一部分,将或多或少的唯一具体的器件。您需要请与设备的制造商,询问他们是否有一种方法可以使用​​的/ mnt / extsd / 从一个普通的SDK应用程序。

If Environment.getExternalStorageDirectory() returns /mnt/sdcard/, then that is the external storage that you should be using in your application. While your device may have other mount points (e.g., /mnt/extsd/), those are not part of the Android SDK and will be more or less unique to your specific device. You will need to contact your device's manufacturer to ask them if there is a way you can use /mnt/extsd/ from a regular SDK application.

如果你有root权限,你可能能够解决此通过的的/ mnt / extsd / 更改权限,但是这是不是一个真正的编程题目,因此超出计算器的范围。

If you have root access, you might be able to work around this by changing permissions on /mnt/extsd/, but that is not really a programming topic and therefore is beyond the scope of StackOverflow.

阅读全文

相关推荐

最新文章