سؤال

I would like to read some text to the user, just like it's possible in Mirror API. Is that possible in Google Glass GDK via Intent?

هل كانت مفيدة؟

المحلول

It's not an intent, but you can use the Android TextToSpeech class for this purpose. Essentially, just create an instance of TextToSpeech and then call the speak method with the string you want it to speak.

There is some initialization overhead involved with the TTS engine so you should try to do it early — you may experience a delay if you try to initialize the engine at the exact moment that you want it to speak.

The CompassService class in the GDK Compass sample shows this in more detail.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top