0
A
回答
1
BitmapFactory.Options bitmapFatoryOptions=new BitmapFactory.Options();
bitmapFatoryOptions.inPreferredConfig=Bitmap.Config.ARGB_8888;
Bitmap myBitmap=BitmapFactory.decodeResource(getResources(),R.drawable.face4,bitmapFatoryOptions);
File mFile = savebitmap(myBitmap);
Uri u = null;
u = Uri.fromFile(mFile);
Intent emailIntent = new Intent(Intent.ACTION_SEND);
emailIntent.setType("image/*");
Intent.setClassName("com.google.android.gm", "com.google.android.gm.ComposeActivityGmail");
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Send Mail");
emailIntent.putExtra(Intent.EXTRA_TEXT, getString(R.string.share_texthere));
emailIntent.putExtra(Intent.EXTRA_STREAM, u);
startActivity(Intent.createChooser(emailIntent,"Send"));
代碼saveBitmap()方法:
private File savebitmap(Bitmap bmp) {
String temp="SplashItShare";
String extStorageDirectory = Environment.getExternalStorageDirectory().toString();
OutputStream outStream = null;
String path = Environment.getExternalStorageDirectory()
.toString();
new File(path + "/SplashItTemp").mkdirs();
File file = new File(path+"/SplashItTemp", temp + ".png");
if (file.exists()) {
file.delete();
file = new File(path+"/SplashItTemp", temp + ".png");
}
try {
outStream = new FileOutputStream(file);
bmp.compress(Bitmap.CompressFormat.PNG, 100, outStream);
outStream.flush();
outStream.close();
} catch (Exception e) {
e.printStackTrace();
return null;
}
return file;
}
希望它會爲你工作。
相關問題
- 1. 附加圖片到電子郵件
- 2. 從Android發送電子郵件時附加圖片
- 3. SwiftMailer在電子郵件正文中附加圖片
- 4. 如何在Android電子郵件中附加圖片
- 5. Docusign電子郵件資源文件
- 6. 如何從圖庫視圖中加載的資產文件夾附加圖像到電子郵件android?
- 7. 在Android中的資產從電子郵件中附加多個圖像
- 8. 爲Android上傳圖片電子郵件附件的問題
- 9. Android \ Intent:發送帶有圖片附件的電子郵件
- 10. 將文件附加到電子郵件
- 11. 在電子郵件中附加文件
- 12. 電子郵件未附加文件
- 13. 添加圖片作爲附件的電子郵件
- 14. 將圖像附加到電子郵件
- 15. 將圖像附加到電子郵件
- 16. 將圖像附加到電子郵件?
- 17. 附加電子名片到電子郵件意向
- 18. powershell腳本附加電子郵件正文中的html文件
- 19. 在電子郵件正文中添加圖片
- 20. 如何在電子郵件正文中添加圖片
- 21. 在電子郵件中附加圖片的最佳格式
- 22. 如何在cakephp的電子郵件中附加圖片?
- 23. 如何將多張圖片附加到電子郵件中?
- 24. 從原生圖庫中選擇圖片並附加到電子郵件
- 25. 9貼片png原始資源附加到電子郵件是不是原始文件
- 26. 如何從電子郵件中的資產中附加pdf文件?
- 27. 從url發送圖像作爲附件電子郵件在Android
- 28. 如何將文件附加到電子郵件? - android
- 29. 如何發送電子郵件與Android中的附加文件?
- 30. 如何在android電子郵件中附加多個文件?
你試過了什麼? –