English | Site Directory

Android - An Open Handset Alliance Project

android.view
public class

android.view.VolumePanel

java.lang.Object
android.view.VolumePanel

Handle the volume up and down keys. This code really should be moved elsewhere.

Summary

Public Constructors

          VolumePanel(Context context, int type, int[] volumes, String setting)

Public Methods

        int  adjustVolume(int amount, int flags)
Adjust the volume up or down.
        int  getIndex()
Get the current index into the volume array
        void  restorePositiveVolume(int flags)
Becomes audible and set to the same level as it was before it went into mute
        void  setIndex(int index, int flags)
Sets the volume array index directly.

Protected Methods

        void  onVolumeChanged(int index, int volume, int flags)
Override this if you have other work to do when the volume changes (for example, vibrating, playing a sound, etc.)
Methods inherited from class java.lang.Object

Details

Public Constructors

public VolumePanel(Context context, int type, int[] volumes, String setting)

Public Methods

public int adjustVolume(int amount, int flags)

Adjust the volume up or down.

Parameters

amount How much to adjust the volume. Must be +1 or -1
flags is the flags parameter from IRingerVolume

Returns

  • the new index

Throws

IllegalArgumentException if amount is not -1 or 1

public int getIndex()

Get the current index into the volume array

public void restorePositiveVolume(int flags)

Becomes audible and set to the same level as it was before it went into mute

Parameters

flags optional flags to be shown/heard

public void setIndex(int index, int flags)

Sets the volume array index directly.

Parameters

index the new index for the volume

Protected Methods

protected void onVolumeChanged(int index, int volume, int flags)

Override this if you have other work to do when the volume changes (for example, vibrating, playing a sound, etc.)
Build m5-rc15g - 14 May 2008 12:50