Convert Toast message to text
问题 How can I convert this TOAST message to voice in Android? Example Toast.makeText(MainActivity.this, "I am enter code here" +positive[+ position]+ " always", Toast.LENGTH_SHORT).show(); 回答1: First import the package import android.speech.tts.TextToSpeech; Then initialize private TextToSpeech tts; tts = new TextToSpeech(this, this); Finally make a function like this private void speakOut() { String text = txtText.getText().toString(); tts.speak(text, TextToSpeech.QUEUE_FLUSH, null); } Woops. I