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.
精彩评论