0
我正在尝试切换Android手机的麦克风。应用。如果我运行静音并取消静音,则会冻结,延迟时间为500ms。移动设备的行为是否有特定的原因? (摩托罗拉Droid甚至无法静音手机),但所有其他手机都能够做到这一点。手机静音时应用程序冻结
这将运行在20次
audioService.setMicrophoneMute(真)的环;
if(audioService.isMicrophoneMute())
{
Toast.makeText(getBaseContext(), "MUTED", 1).show();}
try {
Thread.sleep(1000,90);
}
catch (InterruptedException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
audioService.setMicrophoneMute(false);
if(!audioService.isMicrophoneMute()){
Toast.makeText(getBaseContext(), "Un MUTED", 1).show();
我想问题是“Thread.sleep(1000,90);”因为你在主线程中破坏了这个操作,所以它会在指定的时间内阻塞Ui操作。 – 2014-07-09 07:08:09