-1
我必須在電子郵件中嵌入SD卡中的圖像併發送它。我嘗試使用HTML標籤,但它不工作。任何人都可以幫助我?如何從Android電子郵件客戶端發送嵌入圖像?
我必須在電子郵件中嵌入SD卡中的圖像併發送它。我嘗試使用HTML標籤,但它不工作。任何人都可以幫助我?如何從Android電子郵件客戶端發送嵌入圖像?
這將幫助你
File myDir=new File("/sdcard/Download");
myDir.mkdirs();
String fname = "Image.jpg";
File file = new File (myDir,fname);
try {
FileOutputStream out = new FileOutputStream(file);
finalBitmap.compress(Bitmap.CompressFormat.JPEG, 100, out);
// finalBitmap means sending image.
out.flush();
out.close();
Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setType("Image/jpg");
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Greetings");
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT,"Hi");
File downloadedPic = new File(Environment.getExternalStoragePublicDirectory
(Environment.DIRECTORY_DOWNLOADS),"image.jpg");
emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(downloadedPic));
Full.this.startActivity(Intent.createChooser(emailIntent, "send"));
} catch (Exception e) {}