How to implement the SHARE function of a Android app?

后端 未结 2 1811
感情败类
感情败类 2020-12-30 17:59

Sometimes we can see that after clicking some \"share\" button, a list of sharable ways displays. And that list seems generated dynamically and not hard-coded.

For e

2条回答
  •  天涯浪人
    2020-12-30 18:33

    If you want to add your application in this lists you need to declare in app's AndroidManifest.xml and in your target activity in onCreate() you must handle this intent.

    Example (I get it from Email app and edited a little).

    Docs about Intents and Intent Filters

    About intent-filter as element of AndroidManifest

    For example realisation see source of Android Email application (files AndroidManifest.xml and src/com/android/email/activity/MessageCompose.java (in onCreate())).

提交回复
热议问题