• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Speech Recongnition android.content.ActivityNotFoundException

ulasoc

Lurker
May 7, 2015
3
0
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:
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);
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones