我现在要从服务器获取图像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()
}
}
我已尝试这样做的链接:share multiple imagesAndroid Share Multiple Images with Other Apps
注意:在图像共享过程中,我不想将图像保存到SD卡中
请帮助..任何帮助,感激不尽。
请尝试使用此代码