Hey.
Thanks a lot, but this does not fit to my problem.
I am getting the same error message, but I definitly use the correct URI:
Cursor cursor = cr.query(Phone.CONTENT_URI, projection, Phone.NUMBER+" LIKE
?", new String[] {"%"+phoneNumber, null);
Am Montag, 5. Oktober 2009 03:18:40 UTC+2 schrieb Hamy:
>
> Hi all,
>
> Wanted to try and help some people out here. It took a while to figure
> this out, so hope it helps ;).
>
> So, if you are calling ContentResolver.query() and getting back a null
> Cursor, then you might want to ensure that you are actually passing in
> a valid URI. Only URI's with the content:// scheme can be queried,
> while URI's with the file:// scheme cannot (and will just return
> null)!
>
> To test this, call getScheme() on your URI, and compare it to the
> SCHEME_* constants in the ContentResolver class.
>
> It seems that almost anything coming from the SD card has a file://
> prefix aka SCHEME_FILE. In my case, this was large images. Also, (and
> this is just total speculation) sometimes I magically get a
> SCHEME_CONTENT prefix, which I would attribute to caching of the
> image. This was unpredictable, but I ended up having to plan for both
> FILE and CONTENT to get the problem fixed 100%.
>
> This is not a bug, it is documented, although it could use a bit more
> attention in the docs - It would be nice if the format used in
> (
> http://developer.android.com/reference/android/content/ContentResolver.html#openOutputStream%28android.net.Uri,%20java.lang.String%29
>
> ) was also used in (
>
> http://developer.android.com/reference/android/content/ContentResolver.html#query%28android.net.Uri,%20java.lang.String[],%20java.lang.String,%20java.lang.String[],%20java.lang.String%29
>
> ). This is definitely intended behavior though, see (
>
> http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;f=core/java/android/content/ContentResolver.java;h=74144fc5608fa5b3c219f887f539f8ff12a1efe6;hb=HEAD#l145
>
> ) and (
>
> http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;f=core/java/android/content/ContentResolver.java;h=74144fc5608fa5b3c219f887f539f8ff12a1efe6;hb=HEAD#l572
>
> )
>
> Thanks,
> Hamilton
>
> PS - someone please let me know how to add links to my post!
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
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