简体   繁体   English

Android Intent数据失败并且Intent解析返回ActivityNotFoundException

[英]Android Intent data fails and intent resolution returns ActivityNotFoundException

[Update:] i know the problem... but need help to resolve this. [更新:]我知道问题所在……但是需要帮助来解决。 The issue is the CONTENT_URI is not mapping to the mimetype vnd.android.cursor.dir/vnd.example.manager. 问题是CONTENT_URI没有映射到模仿类型vnd.android.cursor.dir / vnd.example.manager。

i create the Intent with null, and in my intentfiter i have data segment. 我用null创建Intent,在我的intentfiter中,我有数据段。 so i guess it is not matching. 所以我想它不匹配。 So when i pass null in data, everything is good and charming!!., But i need to pass the content_URI and translate it into mimeType. 因此,当我在数据中传递null时,一切都很好并且很迷人!!,但是我需要传递content_URI并将其转换为mimeType。 i have a getType but i guess it is not resolving correctly. 我有一个getType,但我想它无法正确解析。 Could someone please help me out. 有人可以帮我吗。

[Original Post] [原帖]

I'm trying to debug this section with intents in my application and i need help to proceed further. 我正在尝试使用我的应用程序中的意图调试本节,我需要帮助才能继续进行。

I have the main activity and some button. 我有主要活动和一些按钮。 On clicking the button, i would fire an intent for a different activity and upon StartActivity i get an ActivityNotFoundException. 在单击按钮时,我将激发其他活动的意图,并在StartActivity时收到ActivityNotFoundException。

My guess is due to the data mimeType that i have passed to the activity. 我的猜测是由于我传递给活动的数据mimeType所致。 My Intent filter is Below 我的意图过滤器在下面

<intent-filter>
    <action android:name="android.intent.action.INSERT" />
    <category android:name="android.intent.category.DEFAULT" />
    <data android:mimeType="vnd.android.cursor.dir/vnd.example.manager" />
</intent-filter>

This manager is initially empty and there is no table on the first launch of the activity. 该管理器最初是空的,并且在第一次启动活动时没有表。

In my Caller activity's onCreate() i do the following 在我的Caller活动的onCreate()中,执行以下操作

Caller Activity - First entry point for the app 来电者活动-应用程序的第一个入口点

public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);

    setContentView(R.layout.dashboard);       
    someButton.setOnClickListener(new OnClickListener() {

        public void onClick(View v) {
            Intent spawnEmptyIntent = new Intent(Intent.ACTION_INSERT, getIntent().getData());

            if(getIntent().getData() == null) {
                getIntent().setData(ManagerTableDefaults.CONTENT_URI);
            }

            Log.w(TAG, "Intent data string is " + getIntent().getDataString()); --- This is null for some reason!! i don't know why!!... it should have been set earlier right??
            startActivity(spawnEmptyListIntent); // New activity is not launched... Exception thrown
        }
    });

}

Error Log is 错误日志为

10-14 11:21:37.002: WARN/DashboardActivity(8313): Intent data string is null
10-14 11:21:37.012: INFO/ActivityManager(1643): Starting: Intent { act=android.intent.action.INSERT dat=content://com.example.android.provider.ss/manager } from pid 8313
10-14 11:21:37.022: ERROR/AndroidRuntime(8313): FATAL EXCEPTION: main
10-14 11:21:37.022: ERROR/AndroidRuntime(8313): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.INSERT dat=content://com.mvl.android.provider.nq/listmanager }

You aren't setting the data on your spawnEmptyListIntent if getIntent().getData() is null. 如果getIntent()。getData()为null,则无需在spawnEmptyListIntent上设置数据。 I suspect your intent is to set the ManagerTableDefaults.CONTENT_URI as the data URI for your spawnEmptyListIntent 我怀疑你的意图是设置ManagerTableDefaults.CONTENT_URI为您的数据URI spawnEmptyListIntent

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 android相机意图不返回任何数据 - android camera intent returns no data android.content.ActivityNotFoundException:将url传递给intent - android.content.ActivityNotFoundException: passing url to the intent 具有意图的Android相机分辨率 - Android Camera Resolution with Intent Android错误:“ android.content.ActivityNotFoundException:未找到用于处理Intent的活动” - Android error : “android.content.ActivityNotFoundException: No Activity found to handle Intent” Android ActivityNotFoundException无法捕获OS 4.1.2中的Intent(适用于4.0.3)? - Android ActivityNotFoundException failing to catch on Intent in OS 4.1.2 (works on 4.0.3)? android.content.ActivityNotFoundException:未找到用于处理Intent的活动 - android.content.ActivityNotFoundException: No Activity found to handle Intent 致命异常:android.content.ActivityNotFoundException:未找到处理 Intent 的活动 - Fatal Exception: android.content.ActivityNotFoundException: No Activity found to handle Intent android.content.ActivityNotFoundException:未找到任何处理Intent的活动{act = android.intent.action.GET_CONTENT - android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.GET_CONTENT android.content.ActivityNotFoundException:没有找到处理意图的活动{act=android.intent.action.VIEW dat=PendingIntent{} - android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=PendingIntent{ } 调用 Intent.ACTION_CALL 时出现 ActivityNotFoundException - ActivityNotFoundException when calling Intent.ACTION_CALL
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM