Sorry for my misunderstanding of your question.
I think that you can configure the "Media Volume Controller" yourself and control your volume (or Toast). Because the "Media Volume Toast" (this is a toast, see the Source Code of VolumePanel.onShowVolumeChanged ) is created and displayed by the Android system, which you cannot configure.
Here is sample code that might solve your problem:
public boolean onKeyDown(int keyCode, KeyEvent event) {
AudioManager am = (AudioManager) this.getSystemService(Context.AUDIO_SERVICE);
if (keyCode == KeyEvent.KEYCODE_VOLUME_UP) {
am.adjustVolume(AudioManager.ADJUST_RAISE, AudioManager.FLAG_PLAY_SOUND);
Toast.makeText(this, "Volume up", Toast.LENGTH_SHORT).show();
return false;
} else if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) {
am.adjustVolume(AudioManager.ADJUST_LOWER, AudioManager.FLAG_PLAY_SOUND);
Toast.makeText(this, "Volume down", Toast.LENGTH_SHORT).show();
return false;
}
return super.onKeyDown(keyCode, event);
}
source
share