How To Take ScreenShot In Galaxy Nexus
Posted by blogmeister on
May 26, 2012
Considering that the Galaxy Nexus has Ice Cream Sandich as its operating system, this may well be the same with other Android phones running the same OS.
To take a screenshot in Galaxy Nexus, press both power button + volume down. Snap!
You should then see an animation showing you the screenshot.
Donations appreciated. Every little $ helps. Or click Google +1.tags: galaxy nexus, ice cream sandwich, nexus, os, power, screenshot, volume
No Comments
Enable Media Volume In Android Application
Posted by blogmeister on
May 22, 2012
So you want your Android application to be able to change the media volume settings when the user presses the hard key volume buttons on the phone.
The way to do this is to make sure that your Activity class gets a reference of the audio service and override the OnKeyDown() method and catch the keypress event.
Check out the following code:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
// call this in your Activity's onCreate(), make sure the variable is global. AudioManager audio = (AudioManager) getSystemService(Context.AUDIO_SERVICE); @Override public boolean onKeyDown(int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_VOLUME_UP: audio.adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_RAISE, AudioManager.FLAG_SHOW_UI); return true; case KeyEvent.KEYCODE_VOLUME_DOWN: audio.adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_LOWER, AudioManager.FLAG_SHOW_UI); return true; default: return false; } } |









