Code example for AudioManager

Methods: abandonAudioFocus

            mAM.requestAudioFocus(this, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN);
    /** Abandons audio focus. Returns whether request was successful or not. */ 
    public boolean abandonFocus() { 
        return AudioManager.AUDIOFOCUS_REQUEST_GRANTED == mAM.abandonAudioFocus(this);
     * Called by AudioManager on audio focus changes. We implement this by calling our 
     * MusicFocusable appropriately to relay the message. 
    public void onAudioFocusChange(int focusChange) {
        if (mFocusable == null) return;
        switch (focusChange) {
            case AudioManager.AUDIOFOCUS_GAIN:
            case AudioManager.AUDIOFOCUS_LOSS:
            case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT:
Connect your IDE to all the code out there  Get Codota for Java