In my application I use TTS. I have 20 different actions that change when the user scrolls left or right. According to this activity, the text says. I execute tts with a separate thread, and activity selection is done using the main thread. But the problem is very slow, the user interface feels funny. When I scroll left or right, as soon as tts finishes speaking the text, activity changes cannot occur because I use a separate thread for tts. Here is the code:
TTS Class:
public class textToSpeech { TextToSpeech tts=null; public textToSpeech(Context con) { tts = new TextToSpeech(con,new TextToSpeech.OnInitListener() { @Override public void onInit(int status) { if(status != TextToSpeech.ERROR)
Gesture reading class: (separate class)
public void decideAlphabet() { tts.stopSpeak(); threadForTTS.start(); switch (i) { case 0: activities=null; activities = new Intent(contxt,A.class); contxt.startActivity(activities); break; case 1: activities=null; activities = new Intent(contxt,B.class); contxt.startActivity(activities); break; ....... 20 more case statements for selecting activities }
The solveActivity () method is called when it is checked, which has been done, swipe the screen left or right.
Note:
Before adding tts to this application, the user interface performed correctly without delay or slowness. After adding TTS, the application became slow. How can I solve this problem?
Hi
java android text-to-speech
user2498079
source share