Please note that the contents of this offline web site may be out of date. To access the most recent documentation visit the online version .
Note that links that point to online resources are green in color and will open in a new window.
We would love it if you could give us feedback about this material by filling this form (You have to be online to fill it)
Android APIs
Added in API level 8
public static interface

AudioManager.OnAudioFocusChangeListener

android.media.AudioManager.OnAudioFocusChangeListener

Class Overview

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

public abstract void onAudioFocusChange (int focusChange)

Added in API level 8

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.