问题
This is what I have:
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)
)
)
This way I'm sending a text to any available app in the share menu.
But I need to add one PARTICULAR option that doesn't send the text but opens a new activity called DownloadImage
and sends the string imgURL
to it.
Like this:
This doc: https://developer.android.com/training/sharing/send#adding-custom-targets isn't helping because it only shows how to change the content type that is sent to all apps globally.
I've seen this in other apps so this is possible.
来源:https://stackoverflow.com/questions/64412704/android-shareactionprovider-share-menu-add-particular-option