簡體   English   中英

HTC Thunderbolt上的Android Email Multiple Attachment問題

[英]Android Email Multiple Attachment issue on HTC Thunderbolt

我這里有一個奇怪的情況。

我正在嘗試使用以下代碼發送帶有多個附件的電子郵件。

Intent emailIntent = new Intent( android.content.Intent.ACTION_SEND_MULTIPLE );
// emailIntent.setType( "plain/text" );
emailIntent.setType( "application/octet-stream" );
...
....
emailIntent.putParcelableArrayListExtra( Intent.EXTRA_STREAM, uris );

這很好用,隱式意圖機制顯示了很多選項,如Gmail,Skype,Messaging等。

問題是默認的Mail客戶端沒有顯示在HTC Thunderbolt上 (但適用於其他設備,包括HTC Incredible S)。

如果我嘗試使用Intent.ACTION_SEND發送單個附件, Intent.ACTION_SEND顯示默認郵件客戶端 我已經嘗試將內容類型設置為text / plain,appliation / octet-stream,message / rfc282等但是沒有效果。

我在這里錯過了什么?

我有同樣的問題,我修復了使用http Mime庫的多部分表單實體。

這是文件的鏈接。 http://hc.apache.org/httpcomponents-client-4.3.x/httpmime/apidocs/org/apache/http/entity/mime/HttpMultipart.html

聽起來像Thunderbolt的Sense版本中的一個錯誤。 獲勝的自定義用戶界面,對嗎?

無論如何,我會查看應用程序實際上在雷電上處理電子郵件,並使用if語句來檢測設備是否是一個霹靂。 如果是,則將Intent的目標類設置為任何目標類。 如果不是,那就做你正在做的事。

這對我很有用,一定要指定消息類型,這就是android os知道要使用哪個廣播的方式。

     String email = "test@email.com";
    Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE);
    intent.setType("message/rfc822");
    intent.putExtra(Intent.EXTRA_EMAIL, new String[] {email}); // could have multiple address
    intent.putExtra(Intent.EXTRA_SUBJECT, "Enter your subject here");
    intent.putExtra(Intent.EXTRA_TEXT, "message text as needed");
    ArrayList<Uri> arrayUri = new ArrayList<Uri>();
    arrayUri.add(Uri.parse("file://" + paths[0]));
    arrayUri.add(Uri.parse("file://" + paths[1]));
    intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, arrayUri);
    startActivity(Intent.createChooser(intent, "Any title to show on chooser"));

嘗試這個。 我認為它會起作用。

final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND_MULTIPLE);
emailIntent.setType("plain/text");

ArrayList<Uri> uris = new ArrayList<Uri>();

String[] filePaths = new String[] {image1 Path,image2 path};
for (String file : filePaths) {
    File fileIn = new File(file);
    Uri u = Uri.fromFile(fileIn);
    uris.add(u);
}

if ( !(app_preferences.getString("email", "") == null || app_preferences.getString("email", "").equals(""))) {
    emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[] {app_preferences.getString("email", "")});    
}

emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Subject name");
emailIntent.putExtra(Intent.EXTRA_TEXT, "Please find the attachment.");
emailIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM