1
Hello, I’m beginner on android and would like to make a simple translator, where the user write anything and click the button with the desired language to translate aloud, how would be the translation algorithm for other languages ? Just follow my code
@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);
}
});
}
Texttospeech does not translate. It just makes the synthesized speech of the text.
– ramaral