Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/186.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 在ActivityResultLauncher中键入启动方法的输入列表_Android_Kotlin - Fatal编程技术网

Android 在ActivityResultLauncher中键入启动方法的输入列表

Android 在ActivityResultLauncher中键入启动方法的输入列表,android,kotlin,Android,Kotlin,我想从内部存储器添加文件 我的代码 resultLauncher = registerForActivityResult(ActivityResultContracts.GetContent()) { uri : Uri? -> .... } 在启动器中,我只想获取文档文件。 我在教程中看到,我可以对以下图像执行此操作: getContent.launch("image/*") 找不到文档和其他类型的字符串。 我很乐意为你提供一份清单。

我想从内部存储器添加文件

我的代码

resultLauncher = 
registerForActivityResult(ActivityResultContracts.GetContent()) { uri : 
Uri? ->
        ....

    }
在启动器中,我只想获取文档文件。 我在教程中看到,我可以对以下图像执行此操作:

getContent.launch("image/*")
找不到文档和其他类型的字符串。 我很乐意为你提供一份清单。 以及相关信息的链接


谢谢

launch()
接受MIME类型。谢谢我正在搜索docx,但没有,或者至少没有所有类型的doc文件。有一种方法可以添加多个类型?“我正在搜索docx,但没有,或者至少没有所有类型的doc文件”--在DuckDuckGo上搜索
docx mime类型。“有一种方法可以添加多个类型?”--如果您从
GetContent
切换到
OpenDocument
,我认为
launch()
需要
vararg
字符串,因此您可以提供1、2、多或很多MIME类型。