See this page for an introduction on the topic
http://developer.android.com/guide/practices/design/responsiveness.html
Basically anything you do which takes up a considerable amount of time
should be done a different thread to the UI thread.
You can do this by using an AsyncTask, extending the Thread class or
implementing a Runnable object.

Basically you would just move all of the above code into the
doInBackground method of the AsyncTask.

On Jul 21, 7:37 pm, ranjan ar <[email protected]> wrote:
> 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);
>
> try {
>
>     Thread.sleep(500, 40);
>
> } catch (InterruptedException e) {
>
>     // TODO Auto-generated catch block
>
>     e.printStackTrace();
>
> }
>
>  audioService.setMicrophoneMute(false);
>
> Thank you all .

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to