Android - Text To Speech Tutorial
Android allows you convert your text into voice. Not only you can convert it but it also allows you to speak text in variety of different languages. Android provides TextToSpeech class for this purpose. In order to use this class, you need to instantiate an object of this class and also specify the initListnere . Its syntax is given below: private EditText write ; ttobj = new TextToSpeech ( getApplicationContext (), new TextToSpeech . OnInitListener () { @Override public void onInit ( int status ) { } } ); In this listener, you have to specify the properties for TextToSpeech object , such as its language ,pitch e.t.c. Language can be set by calling setLanguage() method. Its syntax is given below − ttobj.setLanguage(Locale.UK); The method setLanguage takes an Locale object as parameter. The list of some of the locales available are given below − Sr.No Locale 1 US 2 CANADA_FRENCH 3 GERMANY 4 ITALY 5 JAPAN 6 CHINA Once you hav...