views:

66

answers:

0

I'm using the MediaStore to share a dynamically generated image using ACTION_SEND.

The code is the following:

String urlString = MediaStore.Images.Media.insertImage(getContentResolver(), path, name, name);
Intent intent = new Intent();
intent.setAction(Intent.ACTION_SEND);
intent.setType("image/jpeg");
intent.putExtra(Intent.EXTRA_STREAM, Uri.parse(result));
intent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.share_subject));
intent.putExtra(Intent.EXTRA_TEXT, getString(R.string.share_text));
Intent chooser = Intent.createChooser(intent, getString(R.string.item_share_title));
startActivity(chooser);

It works fine except that the name of the image file when shared by email is a number, not the name given in the first line. Is there a way to specify the name of the image file when using the MediaStore?