2013-05-18 3 views
0

하나의 안드로이드 응용 프로그램을 개발해야합니다.전자 메일 첨부 파일 android

여기에 이미지를 첨부하고 이메일로 보내야합니다.

다음 코드를 사용하고 있습니다.

여기 내 이미지가 첨부되어 있지만, 보내기 버튼을 클릭하는 동안 첨부 메시지를 보낼 수 없습니다. 왜 이러한 메시지를 받고 있습니까? 내 코드를 검토하고 저에게이에 대한 솔루션을 제공합니다 ...

 Intent email = new Intent(Intent.ACTION_SEND); 
            email.setType("message/rfc822");   
            email.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 
         email.putExtra(Intent.EXTRA_EMAIL, new String[] 
         { 
           "" 
         }); 

         email.putExtra(Intent.EXTRA_SUBJECT, _Title); 

         File sdcard = Environment.getExternalStorageDirectory(); 
         File f = new File (sdcard, _Image); 
         email.putExtra(Intent.EXTRA_STREAM,Uri.parse("file://"+File.separator+"sdcard" 
           + File.separator +_Image)); 

         //email.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(f)); 
         startActivity(Intent.createChooser(email, "Choose an Email client :")); 

편집하십시오

내가 변경 내 코드를 보면 다음과 같은 :

File bitmapFile = new File(Environment.getExternalStorageDirectory()+ 
           "/"+"Android/data/com.xmlparsing/image"+_Image); 
         Uri myUri = Uri.fromFile(bitmapFile); 
         email.putExtra(Intent.EXTRA_STREAM,myUri); 

지금 내가 실행해야 app 및 attach image는 imgae가 첨부하고 있음을 의미하지만 Send 단추를 클릭하면 첨부 파일을 보낼 수 없습니다 ... 어떻게 이러한 오류를 해결할 수 있습니까 ??? 내게 해결책을 주시겠습니까 ???

편집 :

이 그것을 확인 details.please 내 로그 캣입니다.

05-18 17:45:54.351: D/AbsListView(12736): Get MotionRecognitionManager 
05-18 17:45:55.836: D/AbsListView(12736): Get MotionRecognitionManager 
05-18 17:45:55.922: D/libEGL(12736): loaded /vendor/lib/egl/libEGL_POWERVR_SGX540_120.so 
05-18 17:45:55.929: D/libEGL(12736): loaded /vendor/lib/egl/libGLESv1_CM_POWERVR_SGX540_120.so 
05-18 17:45:55.937: D/libEGL(12736): loaded /vendor/lib/egl/libGLESv2_POWERVR_SGX540_120.so 
05-18 17:45:56.047: D/OpenGLRenderer(12736): Enabling debug mode 0 
05-18 17:45:58.890: W/IInputConnectionWrapper(12736): showStatusIcon on inactive InputConnection 
+0

처럼 사용할 수 있습니다. – sachin10

+0

http://stackoverflow.com/questions/3570914/android-how-do-i-attach-a-temporary-generated-image-to-an-email – sachin10

답변

0

이미지의 당신은 당신의 로그 캣 세부 정보를 제공이

Intent email = new Intent(Intent.ACTION_SEND); 
    email.setType("image/jpeg"); 
    File bitmapFile = new File(Environment.getExternalStorageDirectory()+ 
     "/"+<Name of the path folder>+"/a.jpg"); 
    myUri = Uri.fromFile(bitmapFile); 
    email.putExtra(Intent.EXTRA_STREAM, myUri); 
    startActivity(Intent.createChooser(email, "Send your email:")); 
+0

이제 앱을 실행하고 이미지를 첨부해야 imgae를 의미합니다. 첨부 버튼을 클릭하면 첨부 파일을 보낼 수 없습니다. 어떻게 이러한 오류를 해결할 수 있습니까 ??? 제발 해결책을주세요 .. 지금 또한 같은 것을 얻고 있습니다. – user2218667

관련 문제