6

I have a problem regarding my intent. It seems that my app crashes when i select the intent. I found the line of error code due to the stack trace. But i couldn't find anything wrong with it. Hope anyone can help me with this.

This is the java code in line 121:
startActivity(new Intent(Intent.ACTION_INSERT, getIntent().getData()));

This is the stack trace:

11-24 16:09:24.634: ERROR/AndroidRuntime(222): Uncaught handler: thread main exiting due to uncaught exception
11-24 16:09:24.834: ERROR/AndroidRuntime(222): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.INSERT dat=content://joel.google.provider.TemplatePad/templates }
11-24 16:09:24.834: ERROR/AndroidRuntime(222): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1408)
11-24 16:09:24.834: ERROR/AndroidRuntime(222): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1378)
11-24 16:09:24.834: ERROR/AndroidRuntime(222): at android.app.Activity.startActivityForResult(Activity.java:2749)
11-24 16:09:24.834: ERROR/AndroidRuntime(222): at android.app.Activity.startActivity(Activity.java:2855)
11-24 16:09:24.834: ERROR/AndroidRuntime(222): at joel.AndroidGroupSMS.TemplatesList.onOptionsItemSelected(TemplatesList.java:121)
11-24 16:09:24.834: ERROR/AndroidRuntime(222): at android.app.Activity.onMenuItemSelected(Activity.java:2170)
11-24 16:09:24.834: ERROR/AndroidRuntime(222): at com.android.internal.policy.impl.PhoneWindow.onMenuItemSelected(PhoneWindow.java:730)
11-24 16:09:24.834: ERROR/AndroidRuntime(222): at com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:139)
11-24 16:09:24.834: ERROR/AndroidRuntime(222): at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:855)
11-24 16:09:24.834: ERROR/AndroidRuntime(222): at com.android.internal.view.menu.IconMenuView.invokeItem(IconMenuView.java:525)
11-24 16:09:24.834: ERROR/AndroidRuntime(222): at com.android.internal.view.menu.IconMenuItemView.performClick(IconMenuItemView.java:122)
11-24 16:09:24.834: ERROR/AndroidRuntime(222): at android.view.View.onTouchEvent(View.java:4179)
11-24 16:09:24.834: ERROR/AndroidRuntime(222): at android.widget.TextView.onTouchEvent(TextView.java:6541)
11-24 16:09:24.834: ERROR/AndroidRuntime(222): at android.view.View.dispatchTouchEvent(View.java:3709)
11-24 16:09:24.834: ERROR/AndroidRuntime(222): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
11-24 16:09:24.834: ERROR/AndroidRuntime(222): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
11-24 16:09:24.834: ERROR/AndroidRuntime(222): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1643)
11-24 16:09:24.834: ERROR/AndroidRuntime(222): at android.view.ViewRoot.handleMessage(ViewRoot.java:1691)
11-24 16:09:24.834: ERROR/AndroidRuntime(222): at android.os.Handler.dispatchMessage(Handler.java:99)
11-24 16:09:24.834: ERROR/AndroidRuntime(222): at android.os.Looper.loop(Looper.java:123)
11-24 16:09:24.834: ERROR/AndroidRuntime(222): at android.app.ActivityThread.main(ActivityThread.java:4363)
11-24 16:09:24.834: ERROR/AndroidRuntime(222): at java.lang.reflect.Method.invokeNative(Native Method)
11-24 16:09:24.834: ERROR/AndroidRuntime(222): at java.lang.reflect.Method.invoke(Method.java:521)
11-24 16:09:24.834: ERROR/AndroidRuntime(222): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
11-24 16:09:24.834: ERROR/AndroidRuntime(222): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
11-24 16:09:24.834: ERROR/AndroidRuntime(222): at dalvik.system.NativeStart.main(Native Method)
Yoni Samlan
38.1k5 gold badges62 silver badges62 bronze badges
asked Nov 24, 2010 at 16:16

2 Answers 2

1

Can you show us the intent filter you're hoping to match with your implicit intent there? This part:

act=android.intent.action.INSERT dat=content://joel.google.provider.TemplatePad/templates

means you need to have an activity with an intent filter set up to handle implicit requests for the INSERT action on content://joel.google.provider.TemplatePad-schemed URIs.

answered Nov 24, 2010 at 16:50
Sign up to request clarification or add additional context in comments.

15 Comments

<intent-filter> <action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.EDIT" /> <action android:name="android.intent.action.PICK" /> <category android:name="android.intent.category.DEFAULT" /> <data android:mimeType="vnd.android.cursor.dir/vnd.google.note" /> </intent-filter>
Should be the entire comment above that you're talking about.
Are you sure you want a MIME type for picking a vnd.google.note? That looks copied and pasted from Google's notepad example. Additionally, what's the Content Provider manifest element you're using to match that content://joel.google.provider.TemplatePad/templates URI?
Just write the SQLite (or call a common class in your app that makes the SQLite calls, or use an ORM (stackoverflow.com/questions/371538/…)). Otherwise, you'll be writing all your data requests in content-provider syntax, running those through Intents to a ContentProvider, then in turn running those back down into SQLite. The only reason to muck about with ContentProviders is if you want to give 3rd-party apps access to your data. They're a great feature for that, but they just aren't needed for 95%+ of appps.
Great - glad to hear it. I'd appreciate it if you'd mark my answer as accepted if you found it helpful in solving your problem.
|
0

Have you added the Activity to your manifest?

Also your call to StartActivity() looks off. Here is how I am familiar with launching a new Activity

Intent i = new Intent(this, NextActivity.class);
startActivity(i);

Edit: It's come to my attention you likely were not having difficulty with Explicitly launching an Activity. Sorry!

answered Nov 24, 2010 at 16:24

3 Comments

I was having the same problem
Your example is an explicit intent ("start activity X." He's creating an implicit intent ("Start an activity to handle this bunch of data."). They're not interchangeable, assuming what he actually wants to do is set up some bit of code to handle internal or external requests for specific kinds of data.
Ah, my mistake. I haven't had to work with Implicit Intents yet. I should do some research on them to see if they fit some of my current needs.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.