problem with content resolver

All your problems with Audio, Video and Images.

problem with content resolver

Postby valibab » Sat Jan 03, 2009 7:48 am

i want to store the images in the internal memory of emulator and then diaply all of them


i have used this part of code to do so

ContentValues values = new ContentValues(3);

values.put(MediaStore.Images.Media.DISPLAY_NAME, name);
values.put(MediaStore.Images.Media.DESCRIPTION, "Fotos fromserver");
values.put(MediaStore.Images.Media.MIME_TYPE, "image/jpeg");

try {
Uri uri = getContentResolver().insert(MediaStore.Images.Media.INTERNAL_CONTENT_URI, values);
data into it.
save to the database.
OutputStream outStream = getContentResolver().openOutputStream(uri);
b.compress(Bitmap.CompressFormat.JPEG, 50, outStream);
outStream.close();
} catch (Exception e) {
Log.e("Saved Images", "exception while writing image", e);
}

but when i run the code i am facing error like this

01-03 11:00:19.579: ERROR/DatabaseUtils(158): Writing exception to parcel
01-03 11:00:19.579: ERROR/DatabaseUtils(158): java.lang.UnsupportedOperationException: Writing to internal storage is not supported.
01-03 11:00:19.579: ERROR/DatabaseUtils(158): at com.android.providers.media.MediaProvider.generateFileName(MediaProvider.java:1117)
01-03 11:00:19.579: ERROR/DatabaseUtils(158): at com.android.providers.media.MediaProvider.ensureFile(MediaProvider.java:841)
01-03 11:00:19.579: ERROR/DatabaseUtils(158): at com.android.providers.media.MediaProvider.insertInternal(MediaProvider.java:910)
01-03 11:00:19.579: ERROR/DatabaseUtils(158): at com.android.providers.media.MediaProvider.insert(MediaProvider.java:885)
01-03 11:00:19.579: ERROR/DatabaseUtils(158): at android.content.ContentProvider$Transport.insert(ContentProvider.java:139)
01-03 11:00:19.579: ERROR/DatabaseUtils(158): at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:124)
01-03 11:00:19.579: ERROR/DatabaseUtils(158): at android.os.Binder.execTransact(Binder.java:276)
01-03 11:00:19.579: ERROR/DatabaseUtils(158): at dalvik.system.NativeStart.run(Native Method)
01-03 11:00:19.679: ERROR/Saved Images(10609): exception while writing image
01-03 11:00:19.679: ERROR/Saved Images(10609): java.lang.UnsupportedOperationException: Writing to internal storage is not supported.

i am very much new to android and java.
could anyone help me out of this
where i am going wrong.
valibab
Junior Developer
Junior Developer
 
Posts: 19
Joined: Sat Jan 03, 2009 7:11 am

Top

Re: problem with content resolver

Postby chetandl » Wed Aug 18, 2010 4:44 am

Anyone knows how to store the images using ContentResolver
chetandl
Junior Developer
Junior Developer
 
Posts: 23
Joined: Tue Mar 17, 2009 9:17 am

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: No registered users and 16 guests