Thanks for seeing my question.
My problem is that TextToSpeech(this, this);
does not work.
I have initiated it in my code like this.
private TextToSpeech txt2Speech;
then inside onCreate()
txt2Speech = new TextToSpeech(this, this);
And the end of my code I have declared an onInitListener()
like this:
public void onInit(int status) {
// TODO Auto-generated method stub
}
Yet Android Studio shows an error on this line -
txt2Speech = new TextToSpeech(this, this);
Saying that
required type
onInitListener()
does not match the type of myclass
which isMainActivity.java
What Have I Done Wrong? Pls Help me. Thank you in Advance
Make sure your Activity implements TextToSpeech.OnInitListener
, something like this
public class MainActivity extends AppCompatActivity implements TextToSpeech.OnInitListener
from there you are free to override the onInit
method
@Override
public void onInit(int status) {
// your code
}