【发布时间】:2015-02-01 00:48:38
【问题描述】:
我正在上一门关于 Android 的课程,我们有一个任务,其中一个任务是制作一个名为“MyBrowser”的程序,如果另一个程序发送隐式意图,他们提供给我们的程序能够出现在选择器中,我研究并发现了这一点:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="andoid.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" />
</intent-filter>
第一个意图过滤器已经在文件中,我添加了第二个,但它不起作用,我不太明白为什么,隐式意图是这样的:
private void startImplicitActivation() {
Uri webpage = Uri.parse("http://www.google.com");
Intent baseIntent = new Intent (Intent.ACTION_VIEW, webpage);
Intent chooserIntent = Intent.createChooser(baseIntent, "Choose application");
startActivity(chooserIntent);
}
这是我尝试打开的唯一意图。
提前致谢。
【问题讨论】:
标签: android android-manifest browsable