aspose file tools*
The moose likes Android and the fly likes Attaching file which is stored in to the application's directory Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Mobile » Android
Bookmark "Attaching file which is stored in to the application Watch "Attaching file which is stored in to the application New topic
Author

Attaching file which is stored in to the application's directory

Hardik Trivedi
Ranch Hand

Joined: Jan 30, 2010
Posts: 252
Hi all,

I want to attach one audio file to android in-built email client application. TO call that intent I am using


The audio file is stored into applications at path.

I am storing this file using file descriptor. I have also used .

In android's email client it shows option of attachment. But it allows to browse gallery only.

Please help.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42276
    
  64
What is the "it" in "it allows to browse gallery only"? If you want to use the email client's attachment feature for arbitrary files stored on your device then you need to install an application that allows you to browse all files - something like OI File Manager, or any of a number of file managers available.

If, on the other hand, you're trying to attach the file to the intent you're creating, then something like this should work:

emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file:///data/data/<packagename>/files/<filename>"))

The type should be "message/rfc822" for sending email, though.


Ping & DNS - my free Android networking tools app
Hardik Trivedi
Ranch Hand

Joined: Jan 30, 2010
Posts: 252
Ulf Dittmer wrote:emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file:///data/data/<packagename>/files/<filename>"))


I tried this also. It works .It sends mail with the attachment but it displayes file size 0kb.
I am triying to attach the audio file.

I have done so far is ..



I know I just a leap away from my desired output.

Help please
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Attaching file which is stored in to the application's directory