意图过滤器,发射器和发送活动 [英] Intent filter for launcher and send activity

查看:115
本文介绍了意图过滤器,发射器和发送活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图让我的主要活动将是发射活动,并接收发送事件。不知怎的,我似乎无法使双方的工作同时进行。无论是我从画廊例如在应用程序中的托盘不是在图像共享菜单的启动器图标,但随后。我怎样才能使双方的工作在同一时间。

I'm trying to get my main activity to be the launcher activity and also receive send events. Somehow I can't seem to make both work same time. Either I have the launcher icon in the app tray but then not in image share menu in from gallery for example. How can I make both work at the same time.

通过这个意图过滤器的图标在应用程序托盘,但不是在共享菜单。

With this intent filter the icon is in app tray but not in share menu.

         <intent-filter>
            <category android:name="android.intent.category.LAUNCHER"/>
            <action android:name="android.intent.action.MAIN"/>
            <action android:name="android.intent.action.SEND" />
        </intent-filter>

通过这一次我有它的份额,但不是在应用程序托盘

With this one I have it in the share but not in app tray

        <intent-filter>
            <category android:name="android.intent.category.LAUNCHER"/>
            <action android:name="android.intent.action.MAIN"/>
            <action android:name="android.intent.action.SEND" />
            <data android:mimeType="image/*" />
        </intent-filter>

我怀疑它是与数据元素,我试过,但没有奏效。

I suspect it has something to do with the data element and I tried this but it didn't work

        <intent-filter>
            <category android:name="android.intent.category.LAUNCHER"/>
            <action android:name="android.intent.action.MAIN"/>
            <action android:name="android.intent.action.SEND" />
               <data android:mimeType="image/*">
            </action>  
        </intent-filter>

任何帮助非常AP preciated,谢谢!

Any help much appreciated, thank you!

推荐答案

我找到了解决办法。实际上,你可以在一个动作一个以上的意图过滤器标签。因此,正确的code是

I found the solution. You can actually have more than one intent-filter tag in an action. So the right code was

        <intent-filter>
            <category android:name="android.intent.category.LAUNCHER"/>
            <action android:name="android.intent.action.MAIN"/>
        </intent-filter>
        <intent-filter>
            <action android:name="android.intent.action.SEND"/>
            <data android:mimeType="image/*"/>
        </intent-filter>

这篇关于意图过滤器,发射器和发送活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆