How do I set up an audiofile to play when a user touches an image.
Where should I store the audio file and what code should I use to actually play the file?
I don’t want to bring up the MediaPlayer interface or anything like that.
I was thinking of doing it like this:
foo = (ImageView)this.findViewById(R.id.foo);
foo.setOnClickListener(this);
public void onClick(View v) {
if (foo.isTouched()) {
playAudioFile();
}
}
Thanks
This won’t create a bring up the MediaPlayer interface… it will just play the sound you want.
In this case,
R.raw.slayerrepresents an audio file calledslayer.mp3that is stored in theres/raw/folder and once you click the button the droid will rock you…