programmatically send email with data file attachment

by Genesio » Wed, 10 Dec 2008 03:41:39 GMT

Sponsored Links
 Hello to everybody, i am writing a small program which creates a text
file on the external storage (microSD card).
Now i want to send this small file via email (asking the user which
account to use).

I read the sdk docs and I found that with an Intent and this action
Intent.html#ACTION_SENDTO) I can write an email.
But I cannot find any EXTRA_**** to specify an attachment.

I tried with EXTRA_STREAM and an open FileInputStream pointing to the
txt file, but when I see (for example) gmail popping out (basic email
writing works) there is no attachment in the "pre-built" email.

I know this is possible because I installed an application from the
market (Voice Recorder) that already does it.

I would want to reproduce its behaviour.

P.S. Another way to achieve my goal would be to upload via HTTP the
file to a webserver... maybe it's simpler? anyone can give me an
example or show me a JAVA library that implements this functionality??

Thank you


Other Threads

1. how to retreive existing keystore


I forget my existing keystore, How to retreive my existing keystore value?
bcas now i want to update my new version of android i need old
keystore. any alternative ways available?



2. System brightness does not apply changes immediately

       I've modified liblights library to correctly point to the sysfs
file that controls my LCD's backlight brightness. It works correctly
from the kernel side.

My problem is when I move brightness slides in the default android
system brightness settings control, as long as my finger remains
pressed on the slider and move it, the brightness changes, but the
moment I release my finger, the brightness reverts back to the old

I added some debug code to liblights, see what was happening and
discovered this. For example, if the original brightness value was 40,
if I move it all the way up to 100, and release my finger, the values
start automatically rolling back to 40.

If I exit the brightness screen by pressing the OK button, and go back
into the brightness setting the second time, the brightness value gets
set to 100.

It therefore takes an exit and a re-entry to make the brightness
change effective. Why is this the case?

Elvis Dowson


3. YUV--->MPEG

4. ServiceTestCase and Contexts

5. KGDB on Nexus One

6. Custom Contact Sync Adapter - Icons and Titles

7. Best practices for automatic retrying of AsyncTask