Initialize an AudioManager Variable

AUDIO_SERVICE was added in API Level 1
AUDIO_SERVICE: Use with getSystemService(String) to retrieve a AudioManager for handling management of volume, ringer modes and audio routing.

1. Create an AudioManager variable named myAudioManager.

2. In the MainActivity.java file, add the following line. This will get an instance of this class.

myAudioManager = (AudioManager)getSystemService(AUDIO_SERVICE);

3. Compile and run!

Next Recommended Article: Get the Current Ringtone Mode (Normal, Silent, Vibrate)

Resources:
http://developer.android.com/reference/android/content/Context.html#AUDIO_SERVICE