发送带有文本的缩略图 - 没有应用程序可以执行此操作 - 错误

Send thumbnail with text - no app can perform this action - error

我想显示要共享的内容的小预览图。但是,当我 运行 代码时,我收到一条消息,指出没有应用程序可以执行此操作。不幸的是我不知道出了什么问题

    private fun shareContentWithPreview() {
    val share = Intent.createChooser(Intent().apply {
        action = Intent.ACTION_SEND
        putExtra(Intent.EXTRA_TEXT, "https://developer.android.com/training/sharing/")
        type = "image/jpg"
        // (Optional) Here we're setting the title of the content
        putExtra(Intent.EXTRA_TITLE, "Introducing content previews")

        // (Optional) Here we're passing a content URI to an image to be displayed
        val uri: Uri = Uri.parse("android.resource://com.one.myapplication/drawable/rome.jpg")

        data = uri


        flags = Intent.FLAG_GRANT_READ_URI_PERMISSION
    }, null)
    startActivity(Intent.createChooser(share, null))
}

你好 m8 认为你传递的是 putExtra(Intent.EXTRA_TEXT, ...),如果你传递的是 Uri[=10],你应该传递 putExtra(Intent.EXTRA_STREAM, ...) =]