Total newb here....need help playing audio

All your problems with Audio, Video and Images.

Total newb here....need help playing audio

Postby plays2 » Fri Oct 05, 2012 4:12 am

Alright so i have never ever ever made an android app before and im pretty new to java as well.....I'm trying to make it so that (in my app) when i press a button, it would play a sound. And i just cant figure it out. ive searched everywhere, so pleaaassseee help me! i've tried something like this...
@Override
public void onClick(View view) {
MediaPlayer mp = MediaPlayer.create(this, R.raw.a2);
mp.start();
}

and yes i put the a2.mp3 into the res/raw folder
But i get an error that says "Unexpected text found in layout file: "@Override public void onClick(View view)
{ MediaPlayer mp = MediaPlayer.create(this, R.raw.a2);" What do i need to do?
again i'm just starting with java and android so don't gat mad at me(: thanks!
plays2
Once Poster
Once Poster
 
Posts: 1
Joined: Fri Oct 05, 2012 4:05 am

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: No registered users and 10 guests