0
即時通訊我的應用程序人們最多可以選擇6張圖片,在應用程序結束時,我想將這些圖片添加到電子郵件中,以發送到相應的電子郵件地址。Gmail錯誤:添加圖片附件時'cyk:無法創建本地附件'
該系統的工作原理,但是當我補充說:
i.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
Gmail中給出了這樣的錯誤:CYK:無法創建本地連接「一些測試,我發現這是不是所有的圖像後引起
總是在那裏, 如果我添加所有圖像,它只發送最後一個。
這裏是代碼:
public void SendButtonDown(View v){
Intent intent = getIntent();
Uri MAIL_IMAGES_URI = Uri.parse("file://"+MAIL_IMAGES);
Uri MAIL_IMAGES_URI2 = Uri.parse("file://"+MAIL_IMAGES2);
Uri MAIL_IMAGES_URI3 = Uri.parse("file://"+MAIL_IMAGES3);
Uri MAIL_IMAGES_URI4 = Uri.parse("file://"+MAIL_IMAGES4);
Uri MAIL_IMAGES_URI5 = Uri.parse("file://"+MAIL_IMAGES5);
Uri MAIL_IMAGES_URI6 = Uri.parse("file://"+MAIL_IMAGES6);
Intent i = new Intent(Intent.ACTION_SEND);
i.setType("message/rfc822");
i.putExtra(Intent.EXTRA_EMAIL , new String[]{"[email protected]"});
i.putExtra(Intent.EXTRA_SUBJECT , "Subject");
i.putExtra(Intent.EXTRA_TEXT , textVar);
i.setType("application/image");
i.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
i.putExtra(Intent.EXTRA_STREAM , MAIL_IMAGES_URI);
i.putExtra(Intent.EXTRA_STREAM , MAIL_IMAGES_URI2);
i.putExtra(Intent.EXTRA_STREAM , MAIL_IMAGES_URI3);
i.putExtra(Intent.EXTRA_STREAM , MAIL_IMAGES_URI4);
i.putExtra(Intent.EXTRA_STREAM , MAIL_IMAGES_URI5);
i.putExtra(Intent.EXTRA_STREAM , MAIL_IMAGES_URI6);
try {
startActivity(Intent.createChooser(i, "Send mail..."));
} catch (android.content.ActivityNotFoundException ex){
Toast.makeText(AanbiedenStap3.this, "no email installed",
Toast.LENGTH_SHORT).show();
}
finish();
}
}
以下是完整的logcat的:
09-23 15:16:44.065 11793-11793/? E/Gmail: Error adding attachment
cyk: Failed to create local attachment
at cyl.a(SourceFile:344)
at cfe.a(SourceFile:3353)
at cfn.run(SourceFile:6191)
at cfe.a(SourceFile:19310)
at cfe.a(SourceFile:1198)
at cfe.C(SourceFile:1307)
at cfe.onCreate(SourceFile:8505)
at com.google.android.gm.ComposeActivityGmail.onCreate(SourceFile:201)
at android.app.Activity.performCreate(Activity.java:6221)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2611)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2723)
at android.app.ActivityThread.access$900(ActivityThread.java:172)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1422)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5832)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
感謝提前:)
當然,它只發送最後一個。你自己寫了別人。只能有一個'i.putExtra(Intent.EXTRA_STREAM,.....);'。 – greenapps
那麼我如何在一封電子郵件中發送多個圖像? –
附加更多的文件必須做不同。我想知道爲什麼你不要谷歌一點點,以找到如何做到這一點。 – greenapps