【问题标题】:How can I make my Android app appear in the list of apps used to share something? [duplicate]如何让我的 Android 应用出现在用于共享内容的应用列表中? [复制]
【发布时间】:2014-02-07 21:29:21
【问题描述】:

好的,这很难解释,但我不知道该怎么做:

基本上,当您在 Android 中突出显示文本时,您可以选择共享该文本。因此,您只需单击菜单栏中的共享按钮。

现在,如何让我的应用出现在可用于分享文本的应用列表中?

【问题讨论】:

    标签: android button share highlighting


    【解决方案1】:

    只需将以下Intent Filter 添加到您的AndroidManifest.xml 中的活动中:

    <intent-filter>
        <action android:name="android.intent.action.SEND" />
        <category android:name="android.intent.category.DEFAULT"/>
        <data android:mimeType="yourmimehere"/>
    </intent-filter>
    

    【讨论】:

    【解决方案2】:

    创建一个活动 YourActivtiy 并在清单中注册操作发送 mime 类型文本/计划,即使您也可以通过添加另一个意图过滤器来处理图像类型。

    <activity android:name=".YourActivity" >
        <intent-filter>
            <action android:name="android.intent.action.SEND" />
            <category android:name="android.intent.category.DEFAULT" />
            <data android:mimeType="text/plain" />
        </intent-filter>
    </activity>
    

    【讨论】:

      【解决方案3】:

      你必须把这个写成你的清单文件

      <activity android:name=".SomeActivity" >
      <intent-filter>
          <action android:name="android.intent.action.SEND" />
          <category android:name="android.intent.category.DEFAULT" />
          <data android:mimeType="tsome mime here" />
      </intent-filter>
      

      【讨论】:

        猜你喜欢
        • 2023-03-04
        • 2012-06-21
        • 2021-11-07
        • 2020-11-22
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-06-06
        • 2016-09-09
        相关资源
        最近更新 更多