This should be a frighteningly common use case, yet I can't find any
working (i.e. not outdated) documentation or code on this. This is
what I'm doing:
Bitmap b =
BitmapFactory.decodeResource(getResources(),R.drawable.sample_image);
String displayIconUri = Images.Media.insertImage(getContentResolver(),
b, "Sample Display Icon", null);
...and this is the error I get:
Writing exception to parcel
java.lang.UnsupportedOperationException: Unknown URI:
content://media/external/images/media
at
com.android.providers.media.MediaProvider.insert(MediaProvider.java:
856)
at android.content.ContentProvider
$Transport.insert(ContentProvider.java:139)
at
android.content.ContentProviderNative.onTransact(ContentProviderNative.java:
124)
at android.os.Binder.execTransact(Binder.java:276)
at dalvik.system.NativeStart.run(Native Method)
Failed to insert image
java.lang.UnsupportedOperationException: Unknown URI:
content://media/external/images/media
at
android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:
131)
at
android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:
111)
at
android.content.ContentProviderProxy.insert(ContentProviderNative.java:
320)
at android.content.ContentResolver.insert(ContentResolver.java:
335)
at android.provider.MediaStore$Images
$Media.insertImage(MediaStore.java:310)
at com.twitter.angel.TwitterMixin.registerPlugin(TwitterMixin.java:
142)
at
com.twitter.angel.TwitterMixin.doFirstTimeSetup(TwitterMixin.java:83)
at com.twitter.angel.TwitterMixin.onCreate(TwitterMixin.java:95)
at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:
1121)
at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
2094)
at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
2147)
at android.app.ActivityThread.access$1800(ActivityThread.java:112)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:
1572)
at android.os.Handler.dispatchMessage(Handler.java:88)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:3708)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:492)
at com.android.internal.os.ZygoteInit
$MethodAndArgsCaller.run(ZygoteInit.java:734)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:492)
at dalvik.system.NativeStart.main(Native Method)
If someone can show me a correct way to store a freaking image, that
would help, thanks.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---