简体   繁体   English

打开/查看Android外部SD文件和文件夹

[英]Open/View Android External SD files and folders

I am running below lines of code to Open Picture Gallery in Android Programmatically,It working fine . 我正在下面的代码行中以编程方式运行到Android中的Open Picture Gallery,它工作正常。

final static int RQS_GET_IMAGE = 1;
Intent intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(intent, RQS_GET_IMAGE);

In my application sometimes I need to open the external SD card Root Directory to select random file desired by user. 在我的应用程序中,有时我需要打开外部SD卡根目录以选择用户所需的随机文件。 Anyone can guide how can I open (open and explore) the external card files and folders from my application? 任何人都可以指导我如何从应用程序中打开(打开和浏览)外部卡文件和文件夹?

Thanks in advance for help . 在此先感谢您的帮助。

First you need to set user-permission to write access to SD card in Android Manifest file 首先,您需要设置用户权限以在Android Manifest文件中写入对SD卡的访问权限

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

Without it you can't access to SD card. 没有它,您将无法访问SD卡。 Next you should work with SD Card like HDD on PC 接下来,您应该使用PC上的HDD之类的SD卡

Hope, it's help you. 希望对您有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM