Android audio manager method causing a force close
New to this and a bit confused as to why calling the following method creates a force close:
AudioManager myaudiomanag开发者_Python百科er;
public void toggleSilent()
{
myaudiomanager.setRingerMode(AudioManager.RINGER_MODE_SILENT);
}
I don't see any blatant errors and I have added permissions to the manifest regarding the audio manager.
Anyone able to direct me further?
The object is never created first of all. Try that.
myaudiomanager = new AudioManager();
// Not sure what parameters are needed but the documentation in the audiomanager tag has it.
If you posted the ADB log that might help..
A force close usually means your main thread is not responding, or more specifically not withing the alotted time of Android. I find it hard to believe a call into the AudioManager is causing a FC..
精彩评论