my app needs to edit Uris before presentation to ContentResolver and
i'm seeing some weird behaviour with Uris built using Uri.Builder.
here's some code.
contentURI1 is built using the Builder --
Uri.Builder builder = new Uri.Builder ();
builder.scheme ("content");
builder.authority (inURI.getAuthority ());
builder.path (inURI.getPath ());
Uri contentURI1 = builder.build ();
contentURI2 is built using a hardcoded content URI and the ID --
String path = inURI.getPath ();
int lastSlashIndex = path.lastIndexOf ('/');
String idString = path.substring (lastSlashIndex + 1);
Uri contentURI2 = ContentUris.withAppendedId
(MediaStore.Video.Media.EXTERNAL_CONTENT_URI, Long.parseLong (idString));
i log the two of them --
contentURI1 is content://media/external/video/media/1
contentURI2 is content://media/external/video/media/1
check they're equal --
contentURI1.equals (contentURI2) is true
contentResolver.delete() on contentURI2 works.
if i call delete() on contentURI1, then i get a crash --
java.lang.NullPointerException
at android.net.Uri$HierarchicalUri.writeToParcel(Uri.java:1117)
at android.content.ContentProviderProxy.delete(ContentProviderNative.java:376)
at android.content.ContentResolver.delete(ContentResolver.java:526)
of course i have a workaround, but it requires me to hardcode the
content URI, and ideally this piece of code would be content neutral.
(i created a brand new gmail account just for android developers.
let's see whether the list likes this one...)
thanks for any help with this,
--
jason.software.particle
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---