【发布时间】:2014-10-11 12:44:46
【问题描述】:
我想从另一个应用程序 IntentsLab 启动 MyBrowser,这是一个显示网页的应用程序,例如内置浏览器应用程序。
我按照Launch custom android application from android browser 设置了意图,还有the official Intent and Intent-filters guide 确实说“您需要包含 CATEGORY_DEFAULT 才能接收隐式意图”。
所以我的意图过滤器是这样写的:
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.categroy.DEFAULT" />
<data android:scheme="http" />
</intent-filter>
IntentsLab中父Activity启动新Activity的代码为:
Intent baseIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com"));
String title = "Use Browser";
Intent chooserIntent = Intent.createChooser(baseIntent, title);
if(chooserIntent != null) startActivity(chooserIntent);
MyBrowser 应用程序未显示在选择器对话框中。但是,当我在 IntentsLab 中创建一个 Activity 并向其添加相同的意图过滤器时,此 Activity 会显示在选择器对话框中。代码有什么问题吗?或者在同一个应用程序中对活动的隐含意图与在不同应用程序中的活动之间有什么区别?
【问题讨论】:
标签: android android-intent intentfilter