Hello, I just thought I'd post the solution to my problem for future readers.
The reason I was getting null was because there were null content values. The reason for my confusion was because when testing a unit test via instrumentations the same behavior is not present. In a live activity the content values cannot be null while inserting via the provider. This works: ContentValues values = new ContentValues(); context.getContentResolver().insert(CONTENT_URI, values); This does not work: context.getContentResolver().insert(CONTENT_URI, null); But both of these scenarios will work when running unit tests via instrumentations. This behaviour does not seem to be orthogonally correct. Could this be considered a bug? On Sep 29, 5:58 am, hackbod <[EMAIL PROTECTED]> wrote: > Fwiw, permission errors usually result in SecurityException errors > being thrown back to the caller. I don't know of a place where the > system would throw a NullPointerException due to a permission problem. > > On Sep 28, 5:48 pm, chomchom <[EMAIL PROTECTED]> wrote: > > > Hello, All my content providers are accessed via one over arching > > provider that delegates to the others based on the contents of the URI > > pattern matcher. So below just the one provider "RunBuddyProvider" > > There are actually three smaller providers and I have taken steps to > > encapsulate their functionality into one content provider. Interacting > > with the providers via INSERT and QUERY works fine for the > > instrumentation. > > But when using live services that interact with activities I can only > > use QUERY successfully. Using INSERT, I get: > > > ERROR/AndroidRuntime(4197): Uncaught handler: thread main exiting due > > to uncaught exception > > ERROR/AndroidRuntime(4197): java.lang.NullPointerException > > > This suggests to me that the permission has not been granted for the > > application trying to use the content provider. Has anyone used this > > technique or anything similar with content providers? Is this just a > > permissions issue from the Manifest? I would appreciate any comments > > on the implementation. > > > Hearing that other people have had some success with this technique of > > content provider delegation would put my mind at rest that it worked > > and allow me to pursue the bug down the security issues side. > > Can anyone offer any suggestions? > > > # > > # In more detail, with code: > > # > > > The delegating content provider is registered in the Manifest: > > <provider > > android:name=".provider.RunBuddyContentProvider" > > android:authorities="com.novoda.runbuddy" /> > > > This then instantiates the factory which then delegates to the other > > Providers based on the URI pattern matcher. > > Th RoutesProvider is the providers I am using in this instance. When > > instantiated; I call the provider to insert based on the query. But > > this always throws an Uncaught Handler Exception. > > > # All the involved classes > > >http://code.google.com/p/runningbuddy/source/browse/trunk/RunningBudd...... --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---