Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/185.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-ShareActionProvider共享菜单添加特定选项_Android_Kotlin_Android Sharing_Shareactionprovider - Fatal编程技术网

Android-ShareActionProvider共享菜单添加特定选项

Android-ShareActionProvider共享菜单添加特定选项,android,kotlin,android-sharing,shareactionprovider,Android,Kotlin,Android Sharing,Shareactionprovider,这就是我所拥有的: val imgURL = "https://blaaaa.com/pic.jpg" val shareIntent = Intent() shareIntent.action = Intent.ACTION_SEND shareIntent.type = "text/plain" shareIntent.putExtra( Intent.EXTRA_TEXT, context.getString(R.string.c

这就是我所拥有的:

val imgURL = "https://blaaaa.com/pic.jpg"

val shareIntent = Intent()
shareIntent.action = Intent.ACTION_SEND
shareIntent.type = "text/plain"

shareIntent.putExtra(
    Intent.EXTRA_TEXT,
    context.getString(R.string.check_this_out) + " " + domain + "/post/?id=" + meme.id
)

context.startActivity(
    Intent.createChooser(
        shareIntent,
        context.getString(R.string.send_to)
    )
)
通过这种方式,我将向共享菜单中的任何可用应用程序发送文本

但是我需要添加一个特定的选项,该选项不发送文本,而是打开一个名为
DownloadImage
的新活动,并将字符串
imgURL
发送给它

像这样:

此文档:没有帮助,因为它只显示如何更改发送到全局所有应用程序的内容类型

我在其他应用程序中看到过这一点,所以这是可能的