2012-04-12 5 views
4

내가 이미지를 캡처하고 이메일을 보낼 응용 프로그램을 만들려고 노력하고있어, 나는 성공적으로 다음 코드이메일로 이미지를 보내려면 Android를 사용 하시겠습니까?

String path = Images.Media.insertImage(getContentResolver(), bmp,"title", null); 
    Uri screenshotUri = Uri.parse(path); 
    Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); 
    emailIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 
    emailIntent 
      .putExtra(android.content.Intent.EXTRA_EMAIL, emailAddresses); 
    emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject); 
    emailIntent.putExtra(Intent.EXTRA_STREAM, screenshotUri); 
    emailIntent.setType("image/png"); 
    startActivity(Intent.createChooser(emailIntent, "Send email using")); 

하여 만든 그러나 이미지는 작은 크기에 전송되고 매우 낮은 해상도로?! 이미지를 보내려는 제안은 실제 크기와 해상도입니까? 또는 비트 맵 대신 카메라 결과에서 jpeg 이미지를 가져 오는 다른 방법이 있습니까? 사전에

감사

+0

http://stackoverflow.com/questions/2518055/image-attachment-to-a-mail-how-in-android – waqaslam

답변

0
Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); 
emailIntent.setType("plain/text"); 
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, EMAIL_SUBJECT); 
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, EMAIL_TEXT); 
File newFile = new File(Environment.getExternalStorageDirectory(), IMAGE_PATH); 
emailIntent.putExtra(android.content.Intent.EXTRA_STREAM,Uri.fromFile(newFile)); 
startActivity(emailIntent); 
+0

IMAGE_PATH 무엇입니까?! – hatemfaheem

+0

스트림이 파일 경로의 URI를 사용하기 때문에 이미지의 경로 – Basbous

관련 문제