我有一个应用程序,它应该调用一个隐含的意图,我有一个目标,我想收到意图。它始终打开默认应用程序。我不确定错误在哪里。 这是代码:
private void startImplicitActivation() {
Intent baseIntent = new Intent (Intent.ACTION_VIEW, Uri.parse(URL));
Intent chooserIntent = Intent.createChooser(baseIntent, CHOOSER_TEXT) ;
startActivity(chooserIntent);
}
和
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="http"/>
logcat的
[2015-01-29 18:23:14 - IntentsLab] Android Launch!
[2015-01-29 18:23:14 - IntentsLab] adb is running normally.
[2015-01-29 18:23:14 - IntentsLab] Performing course.labs.intentslab.ActivityLoaderActivity activity launch
[2015-01-29 18:23:15 - IntentsLab] Automatic Target Mode: using existing emulator 'emulator-5554' running compatible AVD 'smallapp'
[2015-01-29 18:23:17 - IntentsLab] Application already deployed. No need to reinstall.
[2015-01-29 18:23:17 - IntentsLab] Starting activity course.labs.intentslab.ActivityLoaderActivity on device emulator-5554
[2015-01-29 18:23:21 - IntentsLab] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=course.labs.intentslab/.ActivityLoaderActivity }
[2015-01-29 18:23:21 - IntentsLab] ActivityManager: Warning: Activity not started, its current task has been brought to the front
答案 0 :(得分:0)
您的<intent-filter>
不正确。取代
<data android:mimeType="http"/>
与
<data android:scheme="http"/>
&#34; HTTP&#34;不是一个有效的哑剧类型,可能不是你想要的。