Totally at my wits end.
Created a widget intent/pendingintent.
I am trying to set a variable to the value of the current ringer mode:
AudioManager mAudioManager = (AudioManager) getSystemService(Service.AUDIO_SERVICE); int ringerMode = mAudioManager.getRingerMode(); Log.d(TAG, "ringerMode value=" + ringerMode);
When I debug, it crashes the widget application. LogCat says: Caused by java.lang.NullPointException
If I comment out the line: int ringerMode = mAudioManager.getRingerMode(); The widget will run but obviously not as I intended since my variable is no longer there.
?????
But when I insert that same exact code into a regular app I created and not a widget. It executes fine?
What am I doing wrong?????? Please help.......