【问题标题】:Android Implicit Intents with custom mimeType具有自定义 mimeType 的 Android 隐式意图
【发布时间】:2012-03-26 07:15:30
【问题描述】:

我收到一个 ActivityNotFound 异常,调用如下:

Intent displayModule = new Intent(Intent.ACTION_MAIN);
        displayModule.addCategory(Intent.CATEGORY_DEFAULT);
        displayModule.setType("application/x-content");
        displayModule.putExtra(Modules.Plan_ID, holder.planId);
        displayModule.putExtra(Modules.Module_ID, holder.moduleId);
        startActivity(displayModule);

添加默认类别没有区别。

android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW typ=application/x-content (has extras) }

android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW cat=[android.intent.category.DEFAULT] typ=application/x-content (has extras) }

当我尝试引用此活动时:

<activity android:name=".ContentActivity" >
            <intent-filter>
                    <action android:name="android.intent.action.VIEW" >
                    <category android:name="android.intent.category.DEFAULT" />

                    <data android:mimeType="application/x-content" />
                </action>
            </intent-filter>
        </activity>

此外,如果它有助于我在片段中执行此操作

【问题讨论】:

  • 告诉我你开始活动的电话
  • 出于这个原因,我在顶部包含了来自 logcat 的行。无论如何,我已经更新了问题

标签: android android-intent android-fragments mime-types implicit


【解决方案1】:

我认为这是封闭的action 标签

请试试这个:

<activity android:name=".ContentActivity" >
            <intent-filter>
                    <action android:name="android.intent.action.VIEW" />
                    <category android:name="android.intent.category.DEFAULT" />
                    <data android:mimeType="application/x-content" />
            </intent-filter>
        </activity>

【讨论】:

    猜你喜欢
    • 2016-03-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-07-19
    • 1970-01-01
    • 2013-09-01
    • 1970-01-01
    相关资源
    最近更新 更多