1

play/stop mediaplayer not working

view story
linux-howto

http://stackoverflow.com – i have a media player with tracks on ASSETS folder, i want to make a start/stop button for each song. I'm able to play it but if i click the button again it won't stop the music, it will start another one without stopping the first one :s. Here is the code i'm using right now: public void onClick(View v) { try { AssetFileDescriptor afd = getAssets().openFd("4.mp3"); player = new MediaPlayer(); player.setDataSource(afd.getFileDescriptor(),afd.getStartOffset(),afd.getLength()); player.prepare(); if(player.isPlaying (HowTos)