开发者

Android audio manager method causing a force close

开发者 https://www.devze.com 2023-01-03 02:13 出处:网络
New to this and a bit confused as to why calling the following method creates a force close: AudioManager myaudiomanag开发者_Python百科er;

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..

0

精彩评论

暂无评论...
验证码 换一张
取 消