Code example for MediaPlayer

Methods: releasestop

4
    public void onCompletion(MediaPlayer mediaplayer) {
        Timer endSound = new Timer();
        endSound.schedule(new TimerTask() {
            public void run() { 
                if (mp != null) {
                    mp.stop();
                    mp.release();
                    mp = null;
                } 
            } 
        }, 200); 
 
    } 
 
    /** 
     * Play sound, either locally (from assets) or remotely via URL. 
     *  
     * @param soundUri 
     *            the sound uri 
     */ 
Connect your IDE to all the code out there  Get Codota for Java