简体   繁体   中英

Opening a folder from file manager in android

I want to open a folder "/sdcard/myApp" after I click on a notification that pops up...what I did is

Intent notifyIntent=new Intent();
notifyIntent.setAction(Intent.ACTION_GET_CONTENT);
notifyIntent.setType("file/*");

However, this opens /sdcard and not my desired directory...how to handle this??

First, there is no /sdcard on many Android devices.

Second, having a myApp/ directory in the root of external storage is bad form, and simply will not work on Android 4.2 and higher. Please use the proper methods on Context (eg, getExternalFilesDir() ) and Environment (eg, getExternalStoragePublicDirectory() ) to find appropriate locations on external storage for use.

Third, file/* is not a valid MIME type AFAIK.

Fourth, ACTION_GET_CONTENT is not limited to files, let alone files in a particular directory.

Fifth, there may be nothing on the user's device capable of browsing files, as "file manager" apps are not part of standard Android and do not have to exist on any given device.

If you wish to allow users to browse for a file in a particular directory on external storage, you are welcome to write an activity that does this, or find a library that allows you to add this capability to your project.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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