我想在Android中创建类似whatsapp的目录来存储一些文件.但是我无法在androID中创建文件.我只能在我的包中创建文件/目录(例如com.exampleapp.org)…
我的目标是在androID 4.3的“我的文档”目录中添加一个新文件…
在我的AndroIDManifest.xml中,我设置了以下权限:WRITE_EXTERNAL_STORAGE,READ_EXTERNAL_STORAGE.
有人知道吗?是否可以通过“仅”电话间隙实现?还是我需要一个新插件?
我正在使用cordova 3.4.
谢谢.
解决方法:
要获取documents目录,您应该使用Environment.DIRECTORY_DOCUMENTS
.
要访问它:
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_documentS)
Standard directory in which to place documents that have been created
by the user.
其他目录:
总结public static String DIRECTORY_ALARMS Standard directory in which to
place any audio files that should be in the List of alarms that the
user can select (not as regular music).public static
String DIRECTORY_DCIM The Traditional location for pictures and vIDeos
when mounting the device as a camera.public static
String DIRECTORY_documentS Standard directory in which to place
documents that have been created by the user.public static
String DIRECTORY_DOWNLOADS Standard directory in which to place files
that have been downloaded by the user.public static
String DIRECTORY_MOVIES Standard directory in which to place movIEs
that are available to the user.public static
String DIRECTORY_MUSIC Standard directory in which to place any audio
files that should be in the regular List of music for the user. public
static String DIRECTORY_NOTIFICATIONS Standard directory in which to
place any audio files that should be in the List of notifications that
the user can select (not as regular music).public static
String DIRECTORY_PICTURES Standard directory in which to place
pictures that are available to the user.public static
String DIRECTORY_podcastS Standard directory in which to place any
audio files that should be in the List of podcasts that the user can
select (not as regular music).public static
String DIRECTORY_ringtoneS Standard directory in which to place any
audio files that should be in the List of ringtones that the user can
select (not as regular music).
以上是内存溢出为你收集整理的android-如何在Whatsapp之类的“我的文档”文件夹中添加文件?全部内容,希望文章能够帮你解决android-如何在Whatsapp之类的“我的文档”文件夹中添加文件?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)