How to activate “Share” button in android app?

后端 未结 4 825
我寻月下人不归
我寻月下人不归 2020-11-28 18:17

i want to add \"Share\" button to my android app.

Like that

\":\"

I added \"Share\" button, bu

4条回答
  •  再見小時候
    2020-11-28 19:14

    in kotlin :

    val sharingIntent = Intent(android.content.Intent.ACTION_SEND)
    sharingIntent.type = "text/plain"
    val shareBody = "Application Link : https://play.google.com/store/apps/details?id=${App.context.getPackageName()}"
    sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "App link")
    sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, shareBody)
    startActivity(Intent.createChooser(sharingIntent, "Share App Link Via :"))
    

提交回复
热议问题