Finally after searching a lot i found the solution.
If you want to get any resource URI then there are two ways :
Using Resource Name
Syntax : android.resource://[package]/[res type]/[res name]
Example : Uri.parse("android.resource://com.segf4ult.test/drawable/
icon");
Using Resource Id
Syntax : android.resource://[package]/[resource_id]
Example : Uri.parse("android.resource://com.segf4ult.test/" +
R.drawable.icon);
This were the examples to get the URI of any image file stored in
drawable folder.
Similarly you can get URIs of res/raw folder.
In my case i used 1st way ie. Using Resource Name
On Nov 1, 5:52 pm, Kartik Domadiya <[email protected]> wrote:
> I want to send .mp3 file via mail (using share intent).
>
> I have tried the following code :
>
> Intent share = new Intent(Intent.ACTION_SEND);
> share.setType("*/*");
> share.putExtra(Intent.EXTRA_STREAM,Uri.parse("android.resource://
> com.my.android.package/"+resId));
> startActivity(Intent.createChooser(share, "Share Sound"));
>
> Log of Uri.parse("android.resource://com.my.android.package/"+resId)
> shows the below string :
>
> android.resource://com.my.android.package/2130968609
>
> When i select any mail application, the audio file(.mp3) gets
> attached with resourceId.mp3 file (2130968609). I dont want that.
>
> I want to get fileName.mp3. I want something like android.resource://
> com.my.android.package/fileName.mp3. So that user can recognize the
> file they wanted to share.
>
> How can i do that ?
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en