Correct this is async. I certainly hope we will never ever allow for nested event loops.
On Wed, Jun 17, 2009 at 9:36 PM, Craig <supkic...@gmail.com> wrote: > > Hi, > > I suspect this is not possible, but maybe there is a suggested > solution... > > I want to call an aidl method on a service (the TTS service), from my > service. I want to lazy load TTS only when I need it. e.g. > > class MyService extends Service { > private void generateAudioFromText(String text) { > TTS tts = new TTS(...); > ... > //wait for TTS service to start up > ... > tts.synthesizeToFile(text, ...); > } > > The problem is that this function is called on the main thread, and > the TTS constructor requires waiting for the TTS service to startup, > which also returns on the main thread. Thus there seems to be no way > to wait in that function without deadlocking the app. > > Other frameworks allow you to check the message queue yourself while > waiting, but Android doesn't appear to allow this. e.g. I want to do > something like: > > while(true) { > Looper.getMainLooper().dispatchNextMessageInQueue() > if(the TTS service has initalised ok, or timeout) > break; > } > > Any ideas? > > Craig > > > -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "android-framework" group. To post to this group, send email to android-framework@googlegroups.com To unsubscribe from this group, send email to android-framework+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-framework?hl=en -~----------~----~----~----~------~----~------~--~---