I am trying to convert a layout to image and send it as attachment
using email client. I am using the following code.

TableLayout diplomalayout =
(TableLayout)findViewById(R.id.diplomalayout);
diplomalayout.buildDrawingCache();
Bitmap returnedBitmap =
Bitmap.createBitmap(diplomalayout.getDrawingCache());

diplomalayout.setDrawingCacheEnabled(false);

String path =
android.provider.MediaStore.Images.Media.insertImage(getContentResolver(),
returnedBitmap, "diploma.png", null);
Uri diplomaUri = Uri.parse(path);


final Intent emailIntent2 = new
Intent(android.content.Intent.ACTION_SEND);
emailIntent2.putExtra(Intent.EXTRA_SUBJECT, "Potty Diploma for ");
emailIntent2.putExtra(Intent.EXTRA_TEXT, Html.fromHtml(""));
emailIntent2.putExtra(Intent.EXTRA_STREAM, diplomaUri);
emailIntent2.setType("image/png");
startActivity(Intent.createChooser(emailIntent2, "Email:"));

But I am getting the following error:
ERROR/DatabaseUtils(20678): java.lang.UnsupportedOperationException:
Unknown URI: content://media/external/images/media

Can anyone point the problem in the above code?

-- 
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
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to