开发者

Android tts from service

I wrote a little chat client that uses activity and service design fo开发者_运维问答r android.

The main time the client is running, only the service runs in background and notifys for new messages. Now my problem: The service should speak the incomming message with the help of the internal TTS system, but I have no how to build a "new TextToSpeech()" from the service!

Is there any possibility to create one without having an activity? And if, how?

regards christian


Refer android developers TextToSpeech link Here.

TextToSpeech constructors below.

TextToSpeech(Context context, TextToSpeech.OnInitListener listener)
The constructor for the TextToSpeech class.

sample code refer Here.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜