Speech recognition displays "Android.content.ActivityNotFoundException" on Android Vitals screen. I think SR is not installed in some devices, does not support it, turns it into crashes. What is best way avoiding this crash?
Error Log:
The Code:
Error Log:
Code:
android.content.ActivityNotFoundException:
at android.app.Instrumentation.checkStartActivityResult (Instrumentation.java:1861)
at android.app.Instrumentation.execStartActivity (Instrumentation.java:1534)
at android.app.Activity.startActivityForResult (Activity.java:4125)
at android.app.Activity.startActivityForResult (Activity.java:4072)
at com.myapp.MainActivity.CeviriBaslat (MainActivity.java:705)
at com.myapp.MainActivity.access$300 (MainActivity.java:110)
at com.myapp.MainActivity$7.onClick (MainActivity.java:549)
at android.view.View.performClick (View.java:5246)
at android.view.View$PerformClick.run (View.java:21256)
at android.os.Handler.handleCallback (Handler.java:739)
at android.os.Handler.dispatchMessage (Handler.java:95)
at android.os.Looper.loop (Looper.java:145)
at android.app.ActivityThread.main (ActivityThread.java:6934)
at java.lang.reflect.Method.invoke (Native Method)
at java.lang.reflect.Method.invoke (Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1404)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1199)
The Code:
Code:
private void CeviriBaslat() {
Intent i = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
if (lang.equals("tur")){
i.putExtra(RecognizerIntent.EXTRA_LANGUAGE, "tr-Tr");
i.putExtra(RecognizerIntent.EXTRA_PROMPT, "Haydi birşey söyle!");
}
if (lang.equals("eng")){
i.putExtra(RecognizerIntent.EXTRA_LANGUAGE, Locale.ENGLISH
.toString());
i.putExtra(RecognizerIntent.EXTRA_PROMPT, "Lets say something!");
}
startActivityForResult(i, check);