0
我想通過電子郵件發送.doc文件作爲附件。發送.doc文件作爲郵件的附件
我使用下面的代碼:
final Intent emailIntent = new Intent(
android.content.Intent.ACTION_SEND);
emailIntent.setType("plain/text");
emailIntent.putExtra(
android.content.Intent.EXTRA_SUBJECT,
"Song Pad.");
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT,
"Please see the attached document.");
final File file = new File(dirPath + "/" + filename
+ ".doc");
emailIntent.putExtra(Intent.EXTRA_STREAM,
Uri.parse("file://" + file.getAbsolutePath()));
MainActivity.this.startActivity(Intent.createChooser(
emailIntent, "Send Email..."));
附件成功進入電子郵件,但是當我打開它在設備上它顯示的消息
無法找到觀衆爲純/文。
就當我送doc文件不是通過我的應用程序另一方面則打開完美。
請指導。我認爲有一點小錯誤。 謝謝..
我將不得不使用emailIntent.setType( 「應用程序/ msword」); – helloDroid 2011-12-14 07:41:17