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. About removing all android apps

Hi All,

   I've developed a android app for a device.I have built my app along
with other apps of gingerbread in linux.Now what i want to do is, to
keep my app alone and remove all other
apps(calender,messaging.........etc).how to achieve this?

Any suggestions?

Thanks
Bhavani

-- 

2. simultaneous download of files - best way to handle it

Hi All,

I am writing an application targeting API level 9 or higher. So, i
have decided to go with DownloadManager Class that SDK offers.

My question is 2 part -
1. When i am downloading a single file, how do i display the progress
of the download. I see i can get COLUMN_TOTAL_SIZE_BYTES and
COLUMN_BYTES_DOWNLOADED_SO_FAR from the querying the download manager
instance. But i am not sure if i have to put the query in a thread and
implement a loop so that i can poll regularly to update the progress
bar. I guess, i am not sure, how to query regularly - will it go in
the main thread or be implemented as a runnable - the mechanism i am
not clear.

2. If i have to support multiple file downloads, then do i have to
launch each one of them in it's own thread?

Thanks.

-- 

3. Broadcast receiver not working in Activity

4. keyboard, where are you

5. Android and camera

6. Show default view in activitygroup

7. LG Optimus 2X