Android: How to play button click sound

This stupid snippet was harder to find than expected!

Little did I know that it's part of the base functionality of a View.

All you need to do is call:

yourView.playSoundEffect(SoundEffectConstants.CLICK);

And you'll have yourself some annoying clickity click!

Best thing is you don't have to worry about silent mode either, system handles all that for you.

kprywnakn7 
Enjoy your success!

Source

 
Copyright © Twig's Tech Tips
Theme by BloggerThemes & TopWPThemes Sponsored by iBlogtoBlog