2013-05-16 3 views
2

아래 코드를 사용하여 메일을 보내고 있습니다. Gmail을 통해서만 .text 파일을 보내야합니다. 어떻게 할 수 있습니까? 아무도 도와 주실 수 있습니까?android에서 인 텐트를 사용하여 .text 파일을 보내는 방법은 무엇입니까?

감사의 말. 에서

+0

봐 http://stackoverflow.com/questions/5762073/problem-attaching-internal-file-to-gmail-in-my-android-app 및 http://stackoverflow.com/questions/ 5843834/내 -apple-a-file-from-safe-storage-in-my-app- – NeeL

답변

5
File sd = Environment.getExternalStorageDirectory(); 
File fileDir= new File(sd, "dir_path"); 
Intent email = new Intent(Intent.ACTION_SEND); 
email.putExtra(Intent.EXTRA_STREAM, Uri.parse(fileDir.getAbsolutePath() + "/" 
            + FILE_TXT 
startActivity(Intent.createChooser(email , "Email: Text File")); 
+0

재생 해 주셔서 감사합니다. 여기 FILE_TEXT는 무엇입니까? – suman

+0

상수, 텍스트 파일 이름 – Tarun

+0

나는 sample.text 파일을 보냈지 만 첨부 파일이 없으며 email.setType ("text/plain"); – suman

관련 문제