Android 4.4系统 - 二次SD卡上创建应用程序目录 [英] Android 4.4 - create application dir on secondary sd card

查看:201
本文介绍了Android 4.4系统 - 二次SD卡上创建应用程序目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道即将SD卡由谷歌的Andr​​oid 4.4引入访问的变化。然而,在我的应用程序需要能够将数据存储到一些移动/次要SD卡上。

当我创建的二次使用默认的文件管理器应用程序文件夹(app.xyz.com),那么我能够创建内部迪尔斯和文件。但默认情况下这样的目录这么想的二次SD卡上。

所以,我想以编程方式创建我的应用程序中的应用程序特定的目录...

你有什么想法如何做到这一点?简单file.mkdirs(),即使有正确的应用程序相关的路径,不能正常工作。权限错误...

我有花已经是两个天尝试找到一种方法,没有任何成功

感谢您的帮助!


解决方案

  

你有任何想法如何做到这一点?


使用 getExternalFilesDirs()(注意是复数)。如果该返回多个条目,第二个和后续的是在可移动介质。这些目录可以读取和写入没有任何权限的Andr​​oid 4.4。

I am aware about changes in Access to SD card introduced by Google with Android 4.4. However in my application I need to be able to store data on some removable /secondary sd card.

When I create the application folder (app.xyz.com) on the secondary using default file manager then I am able to create dirs and files inside. But by default such dir dosen't exist on secondary sd card.

So, I would like to create the application specific dir programmatically inside my application…

Do you have any idea how to do this??? Simple file.mkdirs(), even with the correct application related path, doesn’t work. Permission error…

I have spend already two days trying to find a way, without any success

THANKS FOR YOUR HELP!!!

解决方案

Do you have any idea how to do this?

Use getExternalFilesDirs() (note the plural). If that returns more than one entry, the second and subsequent ones are on removable media. Those directories you can read and write to without any permissions on Android 4.4.

这篇关于Android 4.4系统 - 二次SD卡上创建应用程序目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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