sam_k
sam_k

Reputation: 6023

Error in insert data in Own Content Provider?

Here i make my own home screen launcher when i make vent of longpress on screen than i got one dialog box of select options like Widget and Shortcuts etc. so when i select Widget than i got another dialog box like inbuilt applications widgets. when i select any widget for load than i have problem I implemented this whole code with reference of Android 2.3 Source code.

here in this code i have own content provider. When i access its override method insert from another Class using ContentResolver object So When i run this program its Give me Error Like mention Below and I used this thing by this code

Code : Here Notify Value is false.

   Uri result = cr.insert(notify ? LauncherSettings.Favorites.CONTENT_URI :
                LauncherSettings.Favorites.CONTENT_URI_NO_NOTIFICATION, values);

Error

11-21 11:23:50.309: E/ActivityThread(4727): Failed to find provider info for com.test.launcher.settings
11-21 11:23:50.549: D/AndroidRuntime(4727): Shutting down VM
11-21 11:23:50.549: W/dalvikvm(4727): threadid=1: thread exiting with uncaught exception (group=0x40018578)
11-21 11:23:50.589: E/AndroidRuntime(4727): FATAL EXCEPTION: main
11-21 11:23:50.589: E/AndroidRuntime(4727): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=9, result=-1, data=Intent { (has extras) }} to activity {com.test.launcher/com.test.launcher.Launcher}: java.lang.IllegalArgumentException: Unknown URL content://com.test.launcher.settings/favorites?notify=false
11-21 11:23:50.589: E/AndroidRuntime(4727):     at android.app.ActivityThread.deliverResults(ActivityThread.java:2536)
11-21 11:23:50.589: E/AndroidRuntime(4727):     at android.app.ActivityThread.handleSendResult(ActivityThread.java:2578)
11-21 11:23:50.589: E/AndroidRuntime(4727):     at android.app.ActivityThread.access$2000(ActivityThread.java:117)
11-21 11:23:50.589: E/AndroidRuntime(4727):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:965)
11-21 11:23:50.589: E/AndroidRuntime(4727):     at android.os.Handler.dispatchMessage(Handler.java:99)
11-21 11:23:50.589: E/AndroidRuntime(4727):     at android.os.Looper.loop(Looper.java:130)
11-21 11:23:50.589: E/AndroidRuntime(4727):     at android.app.ActivityThread.main(ActivityThread.java:3687)
11-21 11:23:50.589: E/AndroidRuntime(4727):     at java.lang.reflect.Method.invokeNative(Native Method)
11-21 11:23:50.589: E/AndroidRuntime(4727):     at java.lang.reflect.Method.invoke(Method.java:507)
11-21 11:23:50.589: E/AndroidRuntime(4727):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
11-21 11:23:50.589: E/AndroidRuntime(4727):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
11-21 11:23:50.589: E/AndroidRuntime(4727):     at dalvik.system.NativeStart.main(Native Method)
11-21 11:23:50.589: E/AndroidRuntime(4727): Caused by: java.lang.IllegalArgumentException: Unknown URL content://com.test.launcher.settings/favorites?notify=false
11-21 11:23:50.589: E/AndroidRuntime(4727):     at android.content.ContentResolver.insert(ContentResolver.java:600)
11-21 11:23:50.589: E/AndroidRuntime(4727):     at com.test.launcher.Launcher.addItemToDatabase(Launcher.java:420)
11-21 11:23:50.589: E/AndroidRuntime(4727):     at com.test.launcher.Launcher.completeAddAppWidget(Launcher.java:369)
11-21 11:23:50.589: E/AndroidRuntime(4727):     at com.test.launcher.Launcher.onActivityResult(Launcher.java:154)
11-21 11:23:50.589: E/AndroidRuntime(4727):     at com.test.launcher.Launcher.addAppWidget(Launcher.java:308)
11-21 11:23:50.589: E/AndroidRuntime(4727):     at com.test.launcher.Launcher.onActivityResult(Launcher.java:151)
11-21 11:23:50.589: E/AndroidRuntime(4727):     at android.app.Activity.dispatchActivityResult(Activity.java:3908)
11-21 11:23:50.589: E/AndroidRuntime(4727):     at android.app.ActivityThread.deliverResults(ActivityThread.java:2532)
11-21 11:23:50.589: E/AndroidRuntime(4727):     ... 11 more

Upvotes: 4

Views: 2513

Answers (2)

Labeeb Panampullan
Labeeb Panampullan

Reputation: 34833

You need to mention you provider in your manifest file,

Refer provider,
Simple Content Provider for db operations

Upvotes: 3

pdt
pdt

Reputation: 111

You might want to check your URI. i'm not sure if the (?) character is accepted.

Upvotes: 0

Related Questions