2009-06-29 6 views
3

J'essaye de lancer une intention d'email avec un jpg joint.Comment lancer l'intention de courrier électronique avec une image jointe?

J'ai fait:

Intent intent4 = new Intent(Intent.ACTION_SENDTO, 
Uri.fromParts("mailto", "[email protected]", null)); 
startActivity(intent4); 

cette lance l'activité e-mail. Mais quand j'essaie d'ajouter DataAndType (ma pièce jointe jpeg).

Il échoue avec

android.content.ActivityNotFoundException: No Activity found to handle Intent { action=android.intent.action.SENDTO data=file:///data/data/com.mycompany.mypackage/files/temp-picture type=JPEG 


Intent intent4 = new Intent(Intent.ACTION_SENDTO, 
    Uri.fromParts("mailto", "[email protected]", null)); 
intent4.setDataAndType(Uri.parse("file://"+ mTempFilePath), 
    Bitmap.CompressFormat.JPEG.name());  
startActivity(intent4); 

Répondre

1

Avez-vous essayez de régler le mime manuellement "image/jpeg" au lieu de Bitmap.CompressFormat.JPEG.name().

Questions connexes