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. onActivityResult is not called for startActivityForResult

Hi,

  I have an Activity A as launch mode 'singleTask'.

  And  i am launching B from A by using startActivityForResult().

  From i am calling setResult().But onActivityResult() of A not being
called.

  Is there any problem with launch mode of A?

-- 

2. Is it necessary to know the Java APIs to create Android Applications?



That depends on what you mean by "the Java APIs". After all, anything
that is a class inherits from Object, which is a class supplied by "the
Java APIs".

Here are the packages I recommend developers be familiar with before
getting into Android:

java.io
java.lang
java.net
java.util
java.util.concurrent

While there are many other Java packages included in Android, those are
the most important five, IMHO.

I apologize if that is not what you mean by "the Java APIs".

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

Android Training in NYC: 30 April-2 May 2010: http://guruloft.com

-- 

3. DDMS use - allocated memory not freed when BACK pressed?

4. Is it necessary to know the Java APIs to create Android Applications?

5. DDMS use - allocated memory not freed when BACK pressed?

6. KML maps activity

7. How to change the normal behaviour of a listview