Tracing lesson number Android App development Tutorial Urdu and Hindi. Today we will learn how to create Text to Speech Android application in Android studio. Android application development Android studio with the help of simple EditText control and Button Control. In the previous lesson, we have learned how to add an on-click listener in an Android application for a better activity using Android studio.
Today’s news in Nerul is how to use EditText Control to take input to an Android application using Android studio. Visual studio program is to uses text boxes to take input from the user during the test of time that takes application. In the same way in an Android application uses these EditText Input Textbox controls.
There are multiple versions EditText controls are available in Android studio to take input username multiline text. You can edit attributes using property sheet in Android studio using XML code to set the different properties Eidttext control in Android studio.
In this video tutorial created a test application to understand the concept of Text to Speech Android application development in Urdu and Hindi. TextTospeech java class is used to create text to Speech Android application. Most of the settings of text to speech can be learned on the official documentation of Oracle Java and Android studio.
Here is the code snippet that can be added with the help of this code you can create a text-to-speech application in android studio in a very simple way. This code can be seen in the video and then can be used to declare the object of TextToSpeach Java Class.
textSpeaker=new TextToSpeech(getApplicationContext(), new TextToSpeech.OnInitListener() {
@Override
public void onInit(int status) {
if(status != TextToSpeech.ERROR) {
textSpeaker.setLanguage(Locale.UK);
}
}
});
Here is the code snippet that is discussed in the video when you will try to write on click listener functionality for a button control in an Android development application.
btnSpeak.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view)
{
String textToSpeak = etSpeak.getText().toString();
textSpeaker.speak(toSpeak, TextToSpeech.QUEUE_FLUSH, null);
}
});