From: http://rainhomepage.appspot.com/2010/05/hardware-volume-controls-audio-stream-setvolumecontrolstream
When developing multimedia applications or game applications, you need to use the volume control key to setProgram. There are multiple audio streams in the Android system.Setvolumecontrolstream(INT streamtype) You can set the audio stream controlled by the volume control key in the activity, which is generally set in the oncreate function.
There are several audio streams in Android:
- Audiomanager. stream_music/** the audio stream for music playback */
- Audiomanager. stream_ring/** the audio stream for the phone ring */
- Audiomanager. stream_alarm/** the audio stream for alarms */
- Audiomanager. stream_notification/** the audio stream for notifications */
- Audiomanager. stream_system/** the audio stream for system sounds */
- Audiomanager. stream_voicecall/** the audio stream for phone cballs */
Setvolumecontrolstream function description:
Void Android. App. Activity . Setvolumecontrolstream (INT streamtype)
Suggests an audio stream whose volume shocould be changed by the hardware volume controls.
The suggested audio stream will be tied to the window of this activity. if the activity is switched, the stream set here is no longer the suggested stream. the client does not need to save and restore the old suggested stream value in onpause and onresume.
-
Parameters:
-
StreamtypeThe type of the audio stream whose volume shocould be changed by the hardware volume controls. it is not guaranteed that the hardware volume controls will always change this stream's volume (for example, if a call is in progress, its stream's volume may be changed instead ). to reset back to the default, use
Audiomanager. use_default_stream_type
.