Search code examples
androidtext-to-speechtoast

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();

Solution

  • TextView wordView = (TextView)view; String wordChosen = (String) wordView.getText(); Toast.makeText(MainActivity.this, "I am " + positive[+position] + " always", Toast.LENGTH_SHORT).show(); //tts.speak("I am" + blank +position+" always", TextToSpeech.QUEUE_FLUSH, null); tts.speak("You chose, you are "+wordChosen+" today and always", TextToSpeech.QUEUE_FLUSH, null);