chkeff Posted May 6, 2013 Share Posted May 6, 2013 Bonjour à tous ! Comme le titre du sujet le laisse penser, je voudrais envoyer un mail à partir de mon appli en y joignant plusieurs pièces jointes. Je dois envoyer une image et un fichier xml généré à la volé, j'ai fait le test en envoyant soit l'un soit l'autre et ça fonctionne correctement. Le problème se pose quand j'essaye de joindre les 2 fichiers dans mon mail: gmail plante tout simplement :) Voici le code de ma méthode qui permet de créer l'intent: public static Intent createMailIntent(String email, String subject, String content, Uri[] attachments) { Intent mailIntent = new Intent(Intent.ACTION_SEND); mailIntent.setType("text/plain"); mailIntent.putExtra(Intent.EXTRA_EMAIL, new String[] {email}); mailIntent.putExtra(Intent.EXTRA_SUBJECT, subject); mailIntent.putExtra(Intent.EXTRA_TEXT, content); if(attachments != null) { ArrayList uris = new ArrayList(); for(Uri uri: attachments) uris.add(uri); mailIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris); } return mailIntent; } J'ai trouvé la solution de mettre les uris vers les fichiers dans un arraylist sur ce site: http://stackoverflow...ts-using-intent Mais ça ne fonctionne pas et je ne voit pas pourquoi ! Quelqu'un aurait une idée ou une solution ? Merci d'avance ! PS: je ne sais plus comment on affiche du code source dans un post :/ Link to comment Share on other sites More sharing options...
chkeff Posted May 29, 2013 Author Share Posted May 29, 2013 Je n'ai toujours pas réussis à régler mon problème donc je me permet de faire un petit Up ! Link to comment Share on other sites More sharing options...
elmarco06 Posted June 3, 2013 Share Posted June 3, 2013 essaie avec la ligne suivante lors de la création de l'intent Intent email = new Intent(Intent.ACTION_SEND_MULTIPLE); Link to comment Share on other sites More sharing options...
chkeff Posted June 5, 2013 Author Share Posted June 5, 2013 Mon dieu c'était juste ça ... j'ai cherché pendant des heures ! Merci elmarco06 pour ton aide ! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.