Tuesday, November 1, 2011

[android-developers] Get URI of .mp3 file stored in res/raw folder in android

vote 2 down vote favorite
1
share [fb] share [tw]


I have many .mp3 files stored in res/raw folder.

I am getting URI of .mp3 file using following code.

Uri.parse("android.resource:///com.my.android.sharesound/"+resId);

This returns : android.resource:///com.my.android.sharesound/
2130968609

Now I am using this URI in creating Share Intent


shareIntent.putExtra(Intent.EXTRA_STREAM,Uri.parse("android.resource://
com.my.android.sharesound/"+resId));
startActivity(Intent.createChooser(shareIntent,"Share Sound");

When i select any Mail application eg. Gmail or YahooMail from the
Share Intent, the mp3 file attached successfully. But it shows that
2130968609(as an attachment)

i dont want resourceId(2130968609) to appear.

I want to display fileName.mp3

How can i do that? Am i missing something ?

OR

Is there any other way to attach .mp3 file stored in res/raw to mail
via Share Intent.

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate