I am new to Android programming. Haven't even written a single app, so answers that are extremely detailed are appreciated. So, here it goes: I want to assign some .mp3 sound files to an area of the screen.
For eg, if I click on the picture of a cat, meow.mp3 should play. This is applicable to two different activities. Also, I am looking for a way to mute sounds from both activities from a single source, ie, the MainActivity. I tried figuring out some codes, but they weren't detailed enough for my understanding.
Any help is appreciated, thanks!
Well, this is what I did to display an image(playButtonUp) and open up another View. I need to add a .mp3 file so that the action is signified by a sound, like in the case of clicking of a button.
case MotionEvent.ACTION_DOWN:
if ((X > (screenW-playButtonUp.getWidth())/2 &&
X < ((screenW-playButtonUp.getWidth())/2) +
playButtonUp.getWidth()) &&
Y > (int)(screenH*0.7) &&
Y < (int)(screenH*0.7) +
playButtonUp.getHeight()) {
playButtonPressed = true;
break;
}