class SoundTableActivity : AppCompatActivity() , TextToSpeech.OnInitListener {
    private var textToSpeech: TextToSpeech? = null
    override fun onInit(status: Int) {
        if (status == TextToSpeech.SUCCESS) {
            textToSpeech?.let { tts ->
                tts.language = Locale.US
            }
        } else {
  
        }
    }
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_sound_table)
        textToSpeech = TextToSpeech(this, this)
        textToSpeech?.speak("it is Android Text to Speech test", TextToSpeech.QUEUE_FLUSH, null, "utteranceId")    }
 
댓글
댓글 쓰기