Null error when initializing in tts I can't figure out why I'm getting the null error The error does not occur on my equipment, and when I check the log, symptoms sometimes appear even on the same type of device. Do you have any way to solve this problem? I've been thinking about this for a long time, but I can't find a solution
Maybe the problem is because tts is not installed? If so, is there a way to check if tts is installed?
@Override
protected void onCreate(Bundle savedInstanceState) {
...
tts = new TextToSpeech(this, new TextToSpeech.OnInitListener() {
@Override
public void onInit(int status) {
if(status != TextToSpeech.ERROR)
{
try
{
tts.setLanguage(Locale.getDefault()); // NullPointerException
}
catch(StringIndexOutOfBoundsException e)
{
Log.i("debug","onInit e = " + e);
}
}
}
}, "com.google.android.tts");
}