TextToSpeech(这个,这个);不起作用
TextToSpeech(this, this); does not work
感谢您看到我的问题。
我的问题是 TextToSpeech(this, this);
不起作用。
我已经在我的代码中这样启动了它。
private TextToSpeech txt2Speech;
然后里面 onCreate()
txt2Speech = new TextToSpeech(this, this);
在我的代码末尾,我声明了一个 onInitListener()
,如下所示:
public void onInit(int status) {
// TODO Auto-generated method stub
}
然而 Android Studio 在此行显示错误 -
txt2Speech = new TextToSpeech(this, this);
说
required type onInitListener()
does not match the type of my class
which is MainActivity.java
我做错了什么?
请帮助我。
提前致谢
确保您的 Activity 实现了 TextToSpeech.OnInitListener
,类似这样的东西
public class MainActivity extends AppCompatActivity implements TextToSpeech.OnInitListener
从那里您可以自由覆盖 onInit
方法
@Override
public void onInit(int status) {
// your code
}
感谢您看到我的问题。
我的问题是 TextToSpeech(this, this);
不起作用。
我已经在我的代码中这样启动了它。
private TextToSpeech txt2Speech;
然后里面 onCreate()
txt2Speech = new TextToSpeech(this, this);
在我的代码末尾,我声明了一个 onInitListener()
,如下所示:
public void onInit(int status) {
// TODO Auto-generated method stub
}
然而 Android Studio 在此行显示错误 -
txt2Speech = new TextToSpeech(this, this);
说
required type
onInitListener()
does not match the type of myclass
which isMainActivity.java
我做错了什么? 请帮助我。 提前致谢
确保您的 Activity 实现了 TextToSpeech.OnInitListener
,类似这样的东西
public class MainActivity extends AppCompatActivity implements TextToSpeech.OnInitListener
从那里您可以自由覆盖 onInit
方法
@Override
public void onInit(int status) {
// your code
}