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
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to