2012-04-02 6 views
0

私は、このメールでチューザ(良い)を表示しないコードを送信しています。どのように私は、ファイルの添付ファイルを含めるために、それを拡張することができますか?メールに添付ファイルを追加するにはどうすればよいですか?

// Based on http://stackoverflow.com/questions/3312438 
final Intent intent = new Intent(Intent.ACTION_VIEW); 
final Uri data = Uri.parse("mailto:[email protected]?subject=My Sugbject&body="); 
intent.setData(data); 
startActivity(intent); 

答えて

0

はこれを試して、次のコードを試してみてください。

Intent emailintent = new Intent(android.content.Intent.ACTION_SEND); 
emailintent.setType("image/jpeg"); 
emailintent.putExtra(android.content.Intent.EXTRA_TEXT, 
"email body here"); 
emailintent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] 
    {"[email protected]"}); 
emailintent.putExtra(android.content.Intent.EXTRA_SUBJECT, 
"Subject here"); 
String filName="file:///sdcard/photos/estdemo.jpg"; 
emailintent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file:/"+ filName)); 
this.startActivity(emailintent); 
+0

ありがとうImran。それを試してみましたが、いくつかのオプションを持つ選択肢があります。私の質問は、チューザを追加せずに添付ファイルを追加する方法でした。 – user1139880

0

Intent i = new Intent(Intent.ACTION_SEND); 
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 
i.setType("image/jpg"); 
i.putExtra(Intent.EXTRA_STREAM, Uri.parse("photo.jpg")); 
startActivity(i); 
+0

おかげでルシファーにメールを送っするために、次のコードを使用してください。試してみましたが、Picasa、Messagingなどで長い選択がありました – user1139880

+0

xmlの結果を意味していますか? – Lucifer

0

Intent sharingIntent = new Intent(Intent.ACTION_SEND); 
sharingIntent.setType("vnd.android.cursor.dir/email"); 
String to[] = "[email protected]"; 
sharingIntent.putExtra(Intent.EXTRA_EMAIL, to); 
sharingIntent.putExtra(Intent.EXTRA_STREAM,filePath); 
sharingIntent.putExtra(Intent.EXTRA_SUBJECT,"subject"); 
startActivity(Intent.createChooser(sharingIntent, "Send email")); 
+0

Thanks Agarawl。あなたの提案を試してみましたが、まだGmail、Skype、Google Docsのチューザーを手に入れています。 (これを少し変更してリテラルに '{}'を追加し、filePathをファイルURIにしました)。 – user1139880

+0

実際に必要なもの –

関連する問題