在Xoom的编程方式创建一个文件夹 [英] Creating a folder programmatically on a Xoom

查看:183
本文介绍了在Xoom的编程方式创建一个文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Xoom的没有一个工作的SD插槽,因此摩托决定重新将呼叫路由到外部存储到内置存储:

The Xoom does not have a working SD slot, so Moto decided to re-route calls to External Storage to the internal storage:

String path = Environment.getExternalStorageDirectory().getPath() + "/newfolder/";

以上线路恢复对Xoom的内部存储的路径,并在我的Droid的SD卡。

The above line returns a path to the Internal storage on the Xoom, and to the SD card on my Droid.

不过,我无法写在Xoom的这条路。这是因为如果它被写保护,或者我没有权限。

However, I am having trouble writing to this path on a Xoom. It's as if it is write protected, or I do not have permission.

这code创建我的Droid的SD卡上的文件夹,但不能在我的Xoom的存储:

This code creates a folder on my Droid's SD card, but not on my Xoom's storage:

File file = new File(path);
file.mkdir();

一个想法是,由于Xoom的仅仅是伪造,这是外部存储,也许是应用程序所需要的内部存储的权限为好,但没有解决问题。

One thought was that since the Xoom is only "faking" that it is external storage, maybe the app needs the "internal storage" permission as well, but that did not fix it.

推荐答案

在我的XOOM工作汇入作业这样的:

on my xoom it´s working like this:

    private File path;
    path = new File(Environment.getExternalStorageDirectory().toString() + "/audio");
    path.mkdirs();

mkdirs(结尾S),因为这样的方式来结束路径缺少迪尔斯自动创建。

mkdirs (with ending s), because then missing dirs on the way to the end-path are automatically created.

是具有这个你肯定you're在AndroidManifest?

are you sure you´re having this in your AndroidManifest?

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

这篇关于在Xoom的编程方式创建一个文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆