Most visited

Recently visited

Added in API level 8

AudioManager.OnAudioFocusChangeListener

public static interface AudioManager.OnAudioFocusChangeListener

android.media.AudioManager.OnAudioFocusChangeListener


Interface definition for a callback to be invoked when the audio focus of the system is updated.

Summary

Public methods

abstract void onAudioFocusChange(int focusChange)

Called on the listener to notify it the audio focus for this listener has been changed.

Public methods

onAudioFocusChange

Added in API level 8
void onAudioFocusChange (int focusChange)

Called on the listener to notify it the audio focus for this listener has been changed. The focusChange value indicates whether the focus was gained, whether the focus was lost, and whether that loss is transient, or whether the new focus holder will hold it for an unknown amount of time. When losing focus, listeners can use the focus change information to decide what behavior to adopt when losing focus. A music player could for instance elect to lower the volume of its music stream (duck) for transient focus losses, and pause otherwise.

Parameters
focusChange int: the type of focus change, one of AUDIOFOCUS_GAIN, AUDIOFOCUS_LOSS, AUDIOFOCUS_LOSS_TRANSIENT and AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK.

Hooray!