prob in attaching txt file email from internal package file

Tutorials with advanced 'difficulty' and more Lines of Code.

prob in attaching txt file email from internal package file

Postby ycnano » Tue Jun 08, 2010 1:07 pm

Hi,

My objective is to attaching csv file from internal file storage which was created by openFileOutput().
It stored file in: "/data/data/com.example/files/zibra.csv".

I could attach and email file from sdcard as follows
Uri.parse("file://"+Environment.getExternalStorageDirectory()+"/zibra.csv"));
and I could successfully get email in my mail box with attachment.
But while I try to attach from internal file storage using
sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://"+getFilesDir() + "/zibra.csv"));
I receive emails in my mail box but without any attachment.

the code snippets as follows:
Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_EMAIL, recipients);
sendIntent.putExtra(Intent.EXTRA_SUBJECT, "attachment test");
sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse
("file://"+ getFilesDir() + "/zibra.txt"));
//("file://"+Environment.getExternalStorageDirectory()+"/
zibra.txt"));
sendIntent.setType("text/plain");
startActivity(Intent.createChooser(sendIntent, "Send mail..."));

Any righteous solution is welcome..
ycnano
Freshman
Freshman
 
Posts: 5
Joined: Tue Mar 30, 2010 7:03 pm

Top

Re: prob in attaching txt file email from internal package f

Postby stece » Wed Sep 08, 2010 9:48 am

Did you find a solution? I'm trying to do the same.
User avatar
stece
Experienced Developer
Experienced Developer
 
Posts: 62
Joined: Wed Apr 21, 2010 10:50 am
Location: Belgium

Top

Return to Advanced Tutorials

Who is online

Users browsing this forum: No registered users and 4 guests