android11 tts,Android 11使用TextToSpeech实现文字转换语音相关bug:speak failed: not bound to TTS engine...

代码

MainActivity.java

package com.example.myapplication;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;

import android.os.Bundle;

import android.speech.tts.TextToSpeech;

import android.text.TextUtils;

import android.util.Log;

import android.view.View;

import android.widget.Button;

import android.widget.EditText;

import android.widget.Toast;

import java.util.Locale;

public class MainActivity extends AppCompatActivity {

private EditText main_edit_text;

private TextToSpeech mTextToSpeech;

@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_main);

main_edit_text = (EditText)findViewById(R.id.message);

mTextToSpeech = new Te

你可能感兴趣的:(android11,tts)