Android : Thread Synchronization with IntentService

on Saturday, August 16, 2014


I'm trying to create an app that makes http requests through an intentservice. I need the app to wait for the service to finish its run (aka, have the request be returned with some data) before it continues its operations, as its operationss invove manipulation of the data I hope to receive from the http requests. I've tried numerous means of doing so - Semaphore, CountDownLatch, but it seems that for all of them, I need some method of passing in the waiting/counting object into the intentservice so that it can tell the main thread where that object is waiting that it is done processing. How do i go about doing that? Or, if you have a better method of synchronizing threads, what is it? Thanks!


0 comments:

Post a Comment