lundi 25 mai 2015

what are the possible ways to send image via email in android?

I am using following code to send html format to send email in android ,now I want to send Image with it .private void friends_email_share() { Log.i("Send email", ""); String mail_body = "<!DOCTYPE html><html><body>\n" + " <p>Hi,</p>\n" + " <p>Lorem Ipsum <b>Lorem Ipsum Lorem Ipsum Lorem IpsumLorem </b> Lorem IpsumLorem Ipsum</p>\n" + " <p>Lorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem Ipsum.</p>\n" + " <p>Lorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem Ipsum.</p>\n" + " <p>Lorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem Ipsum.</p>\n" + " <p>Lorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem IpsumLorem Ipsum.</p>\n" + "</body></html>"; String[] TO = {}; String[] CC = {}; Intent emailIntent = new Intent(Intent.ACTION_SEND); emailIntent.setData(Uri.parse("mailto:")); emailIntent.setType("text/html"); emailIntent.putExtra(Intent.EXTRA_EMAIL, TO); emailIntent.putExtra(Intent.EXTRA_CC, CC); emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Extra Subject"); emailIntent.putExtra(Intent.EXTRA_TEXT, "" + "\n" + Html.fromHtml(mail_body)); try { startActivity(Intent.createChooser(emailIntent, "Send mail...")); //getActivity().finish(); Log.i("-->", "Finished sending email..."); } catch (android.content.ActivityNotFoundException ex) { Toast.makeText(getApplicationContext(), "There is no email client installed.", Toast.LENGTH_SHORT).show(); } what are the possible ways to send Image via email in android ,I need a serious help here ,thank you ....

Aucun commentaire:

Enregistrer un commentaire