I am trying to play a sound file on the click of a button. The sound is just 1 sec long. It plays well the first few times I click the button, but after a while it gives a <
You should catch Exception.
try this code:
try{ MediaPlayer mplayer = MediaPlayer.create(contextTop, R.raw.); mplayer.start(); }catch(Exception e){ Log.d("" , "error: " + e); }