Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/184.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
与android和kotlin共享_Android_Kotlin - Fatal编程技术网

与android和kotlin共享

与android和kotlin共享,android,kotlin,Android,Kotlin,我想实现共享功能,允许用户通过短信、facebook、电子邮件等共享url。kotlin/android中是否有与ios中相同的共享表功能?我如何使用kotlin代码访问该功能?是的,有一种叫做android共享表的功能。下一个链接中有一些例子是的,有一个叫做Android Sharesheet的东西。您在下一个链接中有一些示例,这应该对您有所帮助: val sharingIntent = Intent(Intent.ACTION_SEND) sharingIntent.type = "text

我想实现共享功能,允许用户通过短信、facebook、电子邮件等共享url。kotlin/android中是否有与ios中相同的共享表功能?我如何使用kotlin代码访问该功能?

是的,有一种叫做android共享表的功能。下一个链接中有一些例子

是的,有一个叫做Android Sharesheet的东西。您在下一个链接中有一些示例,这应该对您有所帮助:

val sharingIntent = Intent(Intent.ACTION_SEND)
sharingIntent.type = "text/plain"
val shareBody = "Text to be shared"
sharingIntent.putExtra(Intent.EXTRA_SUBJECT, "Subject")
sharingIntent.putExtra(Intent.EXTRA_TEXT, shareBody)
context.startActivity(Intent.createChooser(sharingIntent, "Share using ..."))

这将对您有所帮助:

val sharingIntent = Intent(Intent.ACTION_SEND)
sharingIntent.type = "text/plain"
val shareBody = "Text to be shared"
sharingIntent.putExtra(Intent.EXTRA_SUBJECT, "Subject")
sharingIntent.putExtra(Intent.EXTRA_TEXT, shareBody)
context.startActivity(Intent.createChooser(sharingIntent, "Share using ..."))
我建议你用谷歌“共享安卓”或类似的东西来找到解释如何做到这一点的官方文档。我建议你用谷歌“共享安卓”或类似的东西来找到解释如何做到这一点的官方文档。