Is there any predefined sound on android?
I'm wondering, if there is any predefined sounds in Android th开发者_高级运维at I can use in my application.
I was trying to use a class called SoundManager which is build specifically for sound playing in an efficient way.
I realized that what I need is much much smaller than this class. I need a click sound when the button is clicked and a navigation sound when the user navigate through a menu or a set of buttons.
I guess there is something in the android API fit to my purpose but I could not find it. any help please in finding it and hoe to use it?
You could look into the View.playSoundEffect api. This method accepts a SoundEffectConstants value where, among others, a CLICK
constant is available.
Using the MediaPlayer it's really simple, see for instance this SO thread: Android - play sound on button click - Null pointer exception
精彩评论