AudioManager adjustStreamVolume - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for AudioManager adjustStreamVolume method.

This code example shows how to use the following methods:adjustStreamVolume, getStreamVolume
			Log.e("vol", "up " + a + " " + b);
			audioManager.adjustStreamVolume(AudioManager.STREAM_MUSIC,
					AudioManager.ADJUST_RAISE, 0);
		} else { 
			Log.e("vol", "down " + a + " " + b);
			audioManager.adjustStreamVolume(AudioManager.STREAM_MUSIC,
					AudioManager.ADJUST_LOWER, 0);
		} 
		volumnText.setText("Volumn:"
				+ audioManager.getStreamVolume(AudioManager.STREAM_MUSIC));
	} 
 
	boolean inRange(float inX, float inY) {
		if (inX > 400 && inY > 550) {
			return true; 
		} 
		return false; 
	} 
} 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:adjustStreamVolume
	public static void togglePause(Context context) {
		context.sendBroadcast(new Intent("com.android.music.musicservicecommand.togglepause"));
	} 
	 
	public static void volumeDown(AudioManager audioManager) {
		audioManager.adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_LOWER, 0);
	} 
	 
	public static void volumeUp(AudioManager audioManager) {
		audioManager.adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_RAISE, 0);
	} 
} 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:adjustStreamVolume
 
	/** 
	 * Increase the alarm audio streams volume one step. 
	 */ 
	public void increaseVolume() { 
		audioManager.adjustStreamVolume(AudioManager.STREAM_ALARM,
				AudioManager.ADJUST_RAISE, 0);
	} 
 
	/** 
	 * Decrease the alarm audio streams volume one step (if volume greater than 
	 * the VOLUME_MIN_LIMIT). 
	 */ 
	public void decreaseVolume() { 
		if (audioManager.getStreamVolume(AudioManager.STREAM_ALARM) > VOLUME_MIN_LIMIT) {
			audioManager.adjustStreamVolume(AudioManager.STREAM_ALARM,
					AudioManager.ADJUST_LOWER, 0);
		} 
	} 
 
3
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:adjustStreamVolume
		y1_angle = (int)(event.values[1]);  //sud be between 20 and 50
		 
	    if(y1_angle < -20 && y1_angle > -50)
	    { 
	    	 
	    	mAudioManager.adjustStreamVolume(AudioManager.STREAM_RING,AudioManager.ADJUST_LOWER,1);
	    	SystemClock.sleep(200);
	    	if(tm.getCallState() == TelephonyManager.CALL_STATE_RINGING)
	    	mAudioManager.adjustStreamVolume(AudioManager.STREAM_RING,AudioManager.ADJUST_LOWER,1);
	    	SystemClock.sleep(200);
	    	if(tm.getCallState() == TelephonyManager.CALL_STATE_RINGING)
	    	mAudioManager.adjustStreamVolume(AudioManager.STREAM_RING,AudioManager.ADJUST_LOWER,1);
	    	SystemClock.sleep(200);
	    	if(tm.getCallState() == TelephonyManager.CALL_STATE_RINGING)
	    	mAudioManager.adjustStreamVolume(AudioManager.STREAM_RING,AudioManager.ADJUST_LOWER,1);
	    	 
			 
	    	 
	    } 
		} 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:adjustStreamVolume
		mPlayers_file.clear();
		mPlayers_player.clear();
	} 
 
	public void increaseVolume(int flags) {
		volumeControl.adjustStreamVolume(MUSIC_STREAM,
		                                 AudioManager.ADJUST_RAISE,
		                                 flags);
	} 
 
	public void decreaseVolume(int flags) {
		volumeControl.adjustStreamVolume(MUSIC_STREAM,
		                                 AudioManager.ADJUST_LOWER,
		                                 flags);
	} 
 
	public boolean setVolume(int percent, int flags) {
		if (percent < 0 || percent > 100)
			return false; 
 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:adjustStreamVolume
	 * 调整铃声音量 
	 *  
	 * @param direction 
	 */ 
	public void adjustRingVolumn(int direction) {
		audio.adjustStreamVolume(AudioManager.STREAM_RING, direction, AudioManager.FLAG_SHOW_UI);
	} 
 
	/** 
	 * 设置铃声和震动方式 
	 */ 
	public void setPhoneRingAndVibrate(Context context, int ringAndVibrate) {
		if (ringAndVibrate == DeviceManager.RING_AND_VIBRATE) {
			audio.setRingerMode(AudioManager.RINGER_MODE_NORMAL);
			audio.setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER, AudioManager.VIBRATE_SETTING_ON);
			audio.setVibrateSetting(AudioManager.VIBRATE_TYPE_NOTIFICATION, AudioManager.VIBRATE_SETTING_ON);
		} else if (ringAndVibrate == DeviceManager.ONLY_VIBRATE) {
			audio.setRingerMode(AudioManager.RINGER_MODE_VIBRATE);
			audio.setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER, AudioManager.VIBRATE_SETTING_ON);
			audio.setVibrateSetting(AudioManager.VIBRATE_TYPE_NOTIFICATION, AudioManager.VIBRATE_SETTING_ON);
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:adjustStreamVolume
		switch (keyCode) {
		case KeyEvent.KEYCODE_VOLUME_DOWN:
			manager.adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_RAISE, AudioManager.FLAG_SHOW_UI);
			return true; 
		case KeyEvent.KEYCODE_VOLUME_UP:
			manager.adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_LOWER, AudioManager.FLAG_SHOW_UI);
			return true; 
		} 
		 
		return super.onKeyDown(keyCode, event);
	} 
	 
	/** 
	 * <p>operation when touch  to double finger</p> 
	 * @param view		ScanvasContainer in ImageEditor	 
	 * @param event		{@link MotionEvent} 
	 * @return			Whether the event is handled 
	 */ 
	public boolean doubleTouchEvent(RelativeLayout view, MotionEvent event) {
		switch (event.getAction() & MotionEvent.ACTION_MASK) {
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:adjustStreamVolume
 
		downButton.setOnClickListener(new View.OnClickListener() {
			 
			@Override 
			public void onClick(View v) {
				audioManager.adjustStreamVolume(getAudioTypeFromSelection(), AudioManager.ADJUST_LOWER, AudioManager.FLAG_PLAY_SOUND);
				refresh(); 
			} 
		}); 
		 
		audioSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
 
			@Override 
			public void onItemSelected(AdapterView<?> parent, View view,
					int position, long id) {
				refresh();				 
			} 
 
			@Override 
			public void onNothingSelected(AdapterView<?> parent) {
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java

Related AudioManager adjustStreamVolume Questions & Answers:

adjustStreamVolume Method Overview
Adjusts the volume of a particular stream by one step in a direction.
See Code Examples for other Android AudioManager Methods: