2012-07-23 3 views
2

내 안드로이드 응용 프로그램에서 블루투스를 통해 이미지를 공유하고 있습니다. 동시에 나는 우편을 통해 공유하려고 노력했다. 그러나 이미지는 메일에 첨부되지 않습니다. 시체와 함께 보낼뿐입니다. 해결책이 있습니까?메일을 통해 이미지를 안드로이드에 공유

+0

이 어디 코드

OutputStream fOut = null; String fileName = Environment.getExternalStorageDirectory()+"/myImage.png"; File file = new File(fileName); fOut = new FileOutputStream(file); bitmap.compress(Bitmap.CompressFormat.PNG, 85, fOut); fOut.flush(); fOut.close(); 

는 그 다음 Intent 사용하여 첨부 파일로 이미지 파일과 함께 이메일 클라이언트 응용 프로그램을 실행 아래처럼 파일에 기록 할 수 있습니다 ? –

답변

4

전자 메일을 통해 첨부 파일로 이미지를 보내려면 먼저 이미지를 SD 카드에 파일로 저장해야합니다. 이미지가 다음 Bitmap 경우 당신은

Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); 
emailIntent.setType("image/jpeg"); 
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] {""}); 
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, EMAIL_SUBJECT); 
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, EMAIL_BODY); 
emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://"+fileName)); 
startActivity(Intent.createChooser(emailIntent, "Sharing Options")); 
관련 문제