Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/217.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/file/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 选择一个具有获取内容意图的文件_Android_File_Android Intent_Filter - Fatal编程技术网

Android 选择一个具有获取内容意图的文件

Android 选择一个具有获取内容意图的文件,android,file,android-intent,filter,Android,File,Android Intent,Filter,我需要选择一个带有扩展名过滤器的文件,但我不知道如何让它工作 我试过: dicomIntent = new Intent(Intent.ACTION_GET_CONTENT); dicomIntent.setType("file/*.dcm"); dicomList = packageManager.queryIntentActivities(dicomIntent, PackageManager.MATCH_DEFAULT_ONLY); 但它只打开没有过滤器的dropbox 有人知道吗?在

我需要选择一个带有扩展名过滤器的文件,但我不知道如何让它工作

我试过:

dicomIntent = new Intent(Intent.ACTION_GET_CONTENT);
dicomIntent.setType("file/*.dcm"); 
dicomList = packageManager.queryIntentActivities(dicomIntent, PackageManager.MATCH_DEFAULT_ONLY);
但它只打开没有过滤器的dropbox


有人知道吗?

在Android中,没有办法选择受文件扩展名限制的文件,除非您自己创建自己的UI。您可以按MIME类型限制动作内容,但不能按文件扩展名限制。

是否可以在我的应用程序中注册自定义MIME类型?“我还没弄明白怎么做呢!”马奇尼克斯:对不起,我不明白。您可能希望提出一个单独的堆栈溢出问题,以便更详细地解释您的担忧。