callbacks are issued on the ui thread  so you need to poll it instead of the instrumentation thread alternatively  can you use a semaphore instead of polling  makes the code easier  and gets rid of the ugly polling 