我从服务器获取图像 url,现在我想将相同的 url 共享给另一个应用程序,但它说:
不支持该文件格式
这是我的代码:
private fun shareImages(urls:List<String>?) {
var listOfImageUri = ArrayList<Uri>()
for (i in urls!!.indices) {
listOfImageUri.add( Uri.parse(urls[i].url))
}
val shareIntent: Intent = Intent().apply {
action = Intent.ACTION_SEND_MULTIPLE
putParcelableArrayListExtra(Intent.EXTRA_STREAM, listOfImageUri)
type = "image/*"
flags = Intent.FLAG_GRANT_READ_URI_PERMISSION
}
try {
startActivity(Intent.createChooser(shareIntent, "Share Via:"))
} catch (e: ActivityNotFoundException) {
Toast.makeText(baseActivity, "No App Available", Toast.LENGTH_SHORT).show()
}
}
Run Code Online (Sandbox Code Playgroud)
我尝试过的链接: share multiple images Android Share Multiple Images with Other Apps
注意:在图像共享过程中我不想将图像保存到 SD 卡中
请帮助..任何帮助表示赞赏。