IllegalMonitorStateException on 'object.wait()' call randomly

by svd » Fri, 23 Apr 2010 08:04:51 GMT


Sponsored Links
 My code throws an IllegalMonitorStateException on 'object.wait()'
call, even though wait is invoked inside a synchronized block. And
this exception occurs only randomly not always.

below is my code snippet:

while (!mFinish) {
          synchronized (mResponse) {
                    if (!mResponse.isEmpty()) {
                           do something
                    } else {
                        try {
                            mResponse.wait(1000);
                        } catch (InterruptedException ie) {
                           ......
                        }
                    }

          }
}

Also all the 'notify' methods are in synchronized block.
Please point out if there is anything wrong in my code?

--



Other Threads

1. how to avoid getting Menu command to my application after the screen have been locked

Hi,

I am writing my first application in Android and when the screen is
locked I pressing menu to unlocked and I am getting event to my view
( onKeyDown ) and it open the menu of the screen .

how can I avoid getting this event to my application ?

Thanks
Singel ton .

--~--~---------~--~----~------------~-------~--~----~

2. Do the applications keep/manage their own SQLite databases (files)?

Hi All,

Android includes a database engine (SQLite). In general, do the
applications keep/manage their own databases (files) or is there a
unifying database manager?

Thanks,
Matthias

--~--~---------~--~----~------------~-------~--~----~

3. How come the accelrometers maximum sampling rate are so low?

4. adc 2 deadline extention

5. Drawing a transparent Color to a Canvas

6. How do I change the timeout time for the lock screen?

7. Turn on light of trackball on HTC magic