I'm getting reports that, on some (not all) HTC Desire HD (FRF91, 2.2) and HTC EVO 4G ( PC36100|3.29.651.5, 2.2), the TextToSpeech.OnInitListener.onInit(int)
is being called repeatedly (over 1500 times in the space of a few seconds) on the same object. This behaviour does not occur for any of my other users (or with other Desire HD users) AFAICT.
The code is:
TextToSpeech tts = new TextToSpeech(context, new TextToSpeech.OnInitListener() { private int mCallCount = 0; // trying to investigate potential infinite loops @Override public void onInit(int status) { if ((mCallCount % 100) == 1) { // report this } mCallCount++; } });
Anyone any ideas?
EDIT: I have also tried calling the shutdown()
method (the first time multiple listener calls are detected) but this doesn't seem to help.
Maybe you should get around it with your own intermediary method, for example:
private long lastCall = 0; private long deepBreath = 5*1000; //5 seconds private boolean hasRested; TextToSpeech tts = new TextToSpeech(context, new TextToSpeech.OnInitListener() { @Override public void onInit(int status) { long thisCall = Calendar.getInstance().getTimeInMillis(); intermediaryMethod(status, thisCall); } }); //new method public void intermediaryMethod(int status, long thisCall) { hasRested = (thisCall-lastCall)>=deepBreath; if (hasRested) { lastCall = thisCall; //do something about 'status' } }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With