JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
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:
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:
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);
It looks like you need to have an application installed which can handle speech recognition. If you don't then that exception is thrown
https://developer.android.com/reference/android/speech/RecognizerIntent.html#ACTION_RECOGNIZE_SPEECH
This page gives a bit more explanation about how to implement a speech recognition app
https://software.intel.com/en-us/ar...-applications-with-voice-recognition-features
Yes absolutely you must catch the exception if it occurs. See the answer below for a code example of how to do that
https://stackoverflow.com/questions...n-emulator-no-activity-found-to-handle-intent
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies. Accept Learn more…