views:

31

answers:

1

Hello, I am trying to toggle the microphone of Android mobile. App. freezes if I run the mute and unmute in a loop, With a delay of say 500ms. Is there a specific reason mobile behaves this way? (Motorola Droid is not even able to mute the phone) however all other mobiles are able to do it.

This runs in a loop for 20 times

audioService.setMicrophoneMute(true);

    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();
A: 

It was running on main thread, works fine once I spawned a new thread.