October 2018
Intermediate to advanced
464 pages
15h 17m
English
If you only need a basic sound effect, such as a click, you can use the AudioManager playSoundEffect() method. Here's an example:
AudioManager audioManager =(AudioManager)this.getSystemService(Context.AUDIO_SERVICE);audioManager.playSoundEffect(SoundEffectConstants.CLICK);
You can only specify a sound from the SoundEffectConstants; you cannot use your own sound files.