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
发送给它
像这样:
此文档:没有帮助,因为它只显示如何更改发送到全局所有应用程序的内容类型
我在其他应用程序中看到过这一点,所以这是可能的