How to embed image to E-Mail Body in Android? - android

I want to Embed image to E-Mail body.How to do that.I found a lot but still cannot get the solution yet.Is it possible to add an image to E-Mail body?

use Below code
Intent attachmentIntent = new Intent(Intent.ACTION_SEND);
attachmentIntent.setType("image/*");
attachmentIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("your file address"));
startActivity(attachmentIntent);

Related

Android: sending an image by email through intent

So far I've been able to send an image as an attachment but I would like to make it part of the email's body. I know in iOS it is possible to simply pass a link to the image in an but this does not seem to work in Android. I tried using this:
intent.putExtra(Intent.EXTRA_TEXT, Html.fromHtml(removeImgTags("<img.../>"));
But this only appends an object that is however not parsed as an image. I also tried the other version of this method:
Html.fromHtml(url, new MyImageGetter(), null)
And this had the same effect. So is this even possible?

Share Image and Text to Facebook on android

What is the correct way to share an image and text to Facebook in android?
e.g. picture with pre-populated text.
I realise that this is not possible from the native Android share intent as described here. As it can only take an image or a link not both.
Also I have tried using the facebook-sdk-3.14 with:
FacebookDialog.ShareDialogBuilder
but I now realise this is for sharing links only.
I have also tried with:
createShareDialogBuilderForPhoto()
but this is for sharing images only.
Is there something I am missing in the sdk? I am guessing it is not possible from FacebookDialog?
Will I need to go the route of creating my own app in facebook and my own open graph action? Ideally I am looking to not have a login button.
I have also seen similar questions but most are about the share intent or if it is the sdk it at least a year out of date and the solution is some thing similar to this:
Bundle parameters = new Bundle();
parameters.putString("message", category_item_name_desc.getText().toString());
parameters.putString("picture", categoryItemsModel.getImageUrl());
parameters.putString("caption", txtDescription_desc.getText().toString());
facebook.request("/me/feed", parameters, "POST");
Tried it through the Feed Dialog (WebDialog) but im getting a "error (#324) requires upload file", Any help would be great.
You can share your image on facebook, Twitter, and Gmail:
Bitmap b =BitmapFactory.decodeResource(getResources(),R.drawable.ic_launcher);
Intent share = new Intent(Intent.ACTION_SEND);
share.setType(“image/jpeg”);
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
b.compress(Bitmap.CompressFormat.JPEG, 100, bytes);
String path = MediaStore.Images.Media.insertImage(getContentResolver(), b, “Title”, null);
Uri imageUri = Uri.parse(path);
share.putExtra(Intent.EXTRA_STREAM, imageUri);
startActivity(Intent.createChooser(share, “Select”));
Was able to do this my self with the current Facebook SDK (3.14.1 at the time) with no login and I made it into a share intent for adding to the chooser list.
I have a demo project at https://github.com/b099l3/FacebookImageShareIntent only dependency is the facebook sdk and it is contained in one activity.
Please take a look a look on my library: https://github.com/antonkrasov/AndroidSocialNetworks
With help of it, posting is really easy:
mSocialNetworkManager.getFacebookSocialNetwork().postMessage(String message)
mSocialNetworkManager.getFacebookSocialNetwork().postPhoto(File path...)

Send Image and Text both using ACTION_SEND or ACTION_SEND_MULTIPLE

- We have tried to post image and text using the below code:
final Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND_MULTIPLE);
shareIntent.setType("image/png");
shareIntent.putExtra(android.content.Intent.EXTRA_STREAM, Uri.parse("file:///mnt/sdcard/UserImages/"+ ParseUser.getCurrentUser().getObjectId() + ".png"));
shareIntent.putExtra(android.content.Intent.EXTRA_TEXT,"Hello test");
startActivity(Intent.createChooser(shareIntent,"Share"));
- We have also tried using shareIntent.setType("*/*"), but still no luck.
- When we are trying to post this on email, only text is appearing in it, and when we tried posting it on whatsapp then only the image was visible.
- We are unable to post both together, can anyone suggest the proper way of doing it.
Thank you very much in advance.
Now your code gonna work due the new updates to whatsapp, before this didn't accept this kind of intent (ACTION_SEND_MULTIPLE) because it accepts only one file at a time.

Email View doesn't show interpreted HTML

I want compile an email with HTML content which users can see before send it.
I use an
Intent email = new Intent(Intent.ACTION_VIEW);
But I cannot see an HTML interpreted, see the image below:
There is a way to show an HTML interpreted email content?
Thanks a lot
you have to set type for intent :see this method:http://developer.android.com/reference/android/content/Intent.html#setType%28java.lang.String%29
you ahve to add also this line for it shows like html for ur data:
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, Html.fromHtml(body));**strong text**

Embedding image in email in Android

Is it possible to programatically embed an image in the body of an email sent by the Mail app in Android?
Can I use the ACTION_SEND intent to do this, or should I compose the email myself?
to put the image in the body, you need to set the content type to "text/html" and then put an img tag in the email body. if you don't want to use a webserver to host the image, then you can use a data uri for the image.
Info & Sample:
<img src="data:image/png;base64,
iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABGdBTUEAALGP
C/xhBQAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9YGARc5KB0XV+IA
AAAddEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIFRoZSBHSU1Q72QlbgAAAF1J
REFUGNO9zL0NglAAxPEfdLTs4BZM4DIO4C7OwQg2JoQ9LE1exdlYvBBeZ7jq
ch9//q1uH4TLzw4d6+ErXMMcXuHWxId3KOETnnXXV6MJpcq2MLaI97CER3N0
vr4MkhoXe0rZigAAAABJRU5ErkJggg==" alt="Red dot" />
If you want to attach an image to the email, you use the putExtra method and set it to EXTRA_STREAM.
emailIntent.putExtra(android.content.Intent.EXTRA_STREAM, myImageStream);
If your image (or file) is in the SD card, you can proceed as follow:
Intent shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.setType("image/*");
shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file:///sdcard/your_path_in_the_sd_card/your_image.png"));
startActivity(shareIntent);
If you don't want to send image, you need to modify the MIME in the "setType()" method.
For more details check this post.

Categories

Resources