Monday, May 9, 2011

[android-developers] Re: How to define mp3 file in manifest?

no need to add it in manifest
simply create an mediaplayer

this will be the command:
int i=getResources().getIdentifier(s,"raw",getPackageName());
if(i!=0){
MediaPlayer player = new
MediaPlayer().create(getBaseContext(),i);;
player.setVolume(0.9f, 0.9f);
player.start();
}

s=name of the file
raw is folder

On May 7, 7:58 pm, Meba <mehdi.bahr...@gmail.com> wrote:
> Hi,
> I want to use a MP3 file as resource and copy this to res/raw and I
> can access in activity by R.raw.MP3_FILENAME but when start this
> application can't find this resource.(I'm try define it as meta-data
> but I don't know how can I define this name)
> how can I add mp3 file name in manifest and access to this.

--
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