Android - How do I only allow one instance of MediaPlayer to play at a time?
问题 I'm trying to create a simple Sound-board Android app, using ListView items as buttons. (Btw, I'm a novice programmer) The idea is that I press a button, and a specific sound file plays. If I press any button while a sound is playing, it should first stop that sound and then start to play the new one. Currently the sounds play without stopping any currently playing sounds, so that if I spam the buttons I get multiple sounds playing at the same time (and if I press too many at once, the app