@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.layout);
edt_texto =(EditText)findViewById(R.id.edt_texto);
btn =(Button)findViewById(R.id.btn);
t2s = new TextToSpeech(getApplicationContext(), new TextToSpeech.OnInitListener() {
@Override
public void onInit(int status) {
t2s.setLanguage(Locale.getDefault());
}
});
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String fala = edt_texto.getText().toString();
t2s.speak(fala,TextToSpeech.QUEUE_FLUSH,null);
}
});
}