Methods Summary |
---|
static android.speech.tts.UtteranceProgressListener | from(TextToSpeech.OnUtteranceCompletedListener listener)Wraps an old deprecated OnUtteranceCompletedListener with a shiny new
progress listener.
return new UtteranceProgressListener() {
@Override
public synchronized void onDone(String utteranceId) {
listener.onUtteranceCompleted(utteranceId);
}
@Override
public void onError(String utteranceId) {
listener.onUtteranceCompleted(utteranceId);
}
@Override
public void onStart(String utteranceId) {
// Left unimplemented, has no equivalent in the old
// API.
}
};
|
public abstract void | onDone(java.lang.String utteranceId)Called when an utterance has successfully completed processing.
All audio will have been played back by this point for audible output, and all
output will have been written to disk for file synthesis requests.
This request is guaranteed to be called after {@link #onStart(String)}.
|
public abstract void | onError(java.lang.String utteranceId)Called when an error has occurred during processing. This can be called
at any point in the synthesis process. Note that there might be calls
to {@link #onStart(String)} for specified utteranceId but there will never
be a call to both {@link #onDone(String)} and {@link #onError(String)} for
the same utterance.
|
public void | onError(java.lang.String utteranceId, int errorCode)Called when an error has occurred during processing. This can be called
at any point in the synthesis process. Note that there might be calls
to {@link #onStart(String)} for specified utteranceId but there will never
be a call to both {@link #onDone(String)} and {@link #onError(String,int)} for
the same utterance. The default implementation calls {@link #onError(String)}.
onError(utteranceId);
|
public abstract void | onStart(java.lang.String utteranceId)Called when an utterance "starts" as perceived by the caller. This will
be soon before audio is played back in the case of a {@link TextToSpeech#speak}
or before the first bytes of a file are written to storage in the case
of {@link TextToSpeech#synthesizeToFile}.
|