2010-11-16 4 views
4

Quelqu'un peut suggérer comment ajouter des images dans le corps de l'e-mail? Je l'ai essayé, mais pas de réponse.Android Inline Images dans Email

Voici mon code:

Intent sendIntent = new Intent(Intent.ACTION_SEND); 
sendIntent.setType("image/jpeg"); 
sendIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { "[email protected]" }); 
sendIntent.putExtra(Intent.EXTRA_SUBJECT, "Photo"); 
sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://" + _path)); 
sendIntent.setType("image/png;text/html"); 

String htmlecode = 
    "<html><b>Bold Text works perfectly</b>" + 
    "<img width='48' height='48' alt='' " + 
    "src='http://upload.wikimedia.org/wikipedia/commons/7/7a/Basketball.png' />" + 
    "</html>"; 

sendIntent.putExtra(Intent.EXTRA_TEXT, Html.fromHtml(htmlecode, imgGetter, null)); 

startActivity(Intent.createChooser(sendIntent, "Email:")); 

wat a tort dans ce code?

Répondre

0

Il existe un article similaire here. Ils suggèrent d'utiliser:

emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file:///mnt/sdcard/Myimage.jpeg"));