public class InternalTextToSpeech extends java.lang.Object implements ITextToSpeech
TextToSpeech
class, which doesn't exist on
pre-1.6 devices.
We need to wrap this because the Dalvik class loader will fail to verify a class that contains
references to non-existence classes and therefore we arrange for the failure to occur in this
class, rather than the component class which references this. The component class can figure
out whether it wants to use this wrapper class or not depending on the SDK level.
See http://android-developers.blogspot.com/2009/04/backward-compatibility-for-android.html for
some more about this.ITextToSpeech.TextToSpeechCallback
Constructor and Description |
---|
InternalTextToSpeech(android.app.Activity activity,
ITextToSpeech.TextToSpeechCallback callback) |
Modifier and Type | Method and Description |
---|---|
boolean |
isInitialized() |
int |
isLanguageAvailable(java.util.Locale loc) |
void |
onDestroy()
This will be called when the Activity is destroyed, to give us a chance to cleanup resources,
if necessary.
|
void |
onResume()
This will be called when the Activity is resumed, to give us a chance to re-initialize
resources, if necessary.
|
void |
onStop()
This will be called when the Activity is stopped, to give us a chance to cleanup resources,
if necessary.
|
void |
setPitch(float pitch)
Sets the speech pitch for the TextToSpeech
|
void |
setSpeechRate(float speechRate)
Sets the speech rate
|
void |
speak(java.lang.String message,
java.util.Locale loc)
Speaks the given message corresponding to the language and country of the given locale.
|
public InternalTextToSpeech(android.app.Activity activity, ITextToSpeech.TextToSpeechCallback callback)
public void speak(java.lang.String message, java.util.Locale loc)
ITextToSpeech
speak
in interface ITextToSpeech
message
- the message to speakloc
- the locale to usepublic boolean isInitialized()
isInitialized
in interface ITextToSpeech
public void onStop()
ITextToSpeech
onStop
in interface ITextToSpeech
public void onDestroy()
ITextToSpeech
onDestroy
in interface ITextToSpeech
public void onResume()
ITextToSpeech
onResume
in interface ITextToSpeech
public void setPitch(float pitch)
ITextToSpeech
setPitch
in interface ITextToSpeech
pitch
- 1.0 is the normal pitch, lower values lower the tone of the synthesized voice,
greater values increase it.public void setSpeechRate(float speechRate)
ITextToSpeech
setSpeechRate
in interface ITextToSpeech
speechRate
- Speech rate. 1.0 is the normal speech rate, lower values slow down the
speech (0.5 is half the normal speech rate), greater values
accelerate it (2.0 is twice the normal speech rate).public int isLanguageAvailable(java.util.Locale loc)
isLanguageAvailable
in interface ITextToSpeech