How to set the language in speech recognition on android?

I’ve been working on speech Recognition API in android and found out that the speech results vary allot when the language settings are changed , is there a way to set it programmatically ? or is there an intent to lunch the speech language settings screen ? or what else ?
I tried to use this intent extra:

intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE, "en-US");

but it was ineffective

  • Travis CI build doesn't work with Android Constraint Layout
  • implement android:src=“@drawable/image” programmatically in Android
  • layout of the screen moves up when keyboard is displayed
  • Copy directory from Assets to local directory
  • How can I limit the number of rows in Android SQLite table
  • Is it possible to get access to the speaker signal on Android?
  • Related posts:

    Android - Bitmap and memory management?
    Peer to peer android and iOS with Wifi direct (multipeer connectivity?)
    Android - How to set a named method in button.setOnClickListener()
    java missing required source folder: 'gen'
    Android: how to make a clickable map image with each country producing a different action?
    SearchView expand/collapse animation in Android
  • Android Emulator is so slow that it is unusable
  • android onCheckedChanged for radiogroup
  • Why is `hasEnrolledFingerprints` giving error that it requires a permission only in my Fragment but not in the Activity in Google's Example?
  • Keytool Signing Problem: Keystore was tampered with, or password was incorrect
  • Can i use AlarmManager with LocalBroadcastManager on android?
  • Android L's Ripple Effect - Touch Feedback for Buttons - Using XML
  • 6 Solutions collect form web for “How to set the language in speech recognition on android?”

    As pargat says, this will do it:

    intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, "en-US");

    Also, your app can query for the list of supported languages by sending a RecognizerIntent.ACTION_GET_LANGUAGE_DETAILS ordered broadcast like so:

        Intent detailsIntent =  new Intent(RecognizerIntent.ACTION_GET_LANGUAGE_DETAILS);
                detailsIntent, null, new LanguageDetailsChecker(), null, Activity.RESULT_OK, null, null);

    where LanguageDetailsChecker is something like this:

    public class LanguageDetailsChecker extends BroadcastReceiver
        private List<String> supportedLanguages;
        private String languagePreference;
        public void onReceive(Context context, Intent intent)
            Bundle results = getResultExtras(true);
            if (results.containsKey(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE))
                languagePreference =
            if (results.containsKey(RecognizerIntent.EXTRA_SUPPORTED_LANGUAGES))
                supportedLanguages =

    For the complete code check out this github project:

    there is no solution but a hackaround…

    intent.putExtra("android.speech.extra.EXTRA_ADDITIONAL_LANGUAGES", new String[]{"en"});

    check here the complete story.

    Have you tried this:

    intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, "en-US");

    This will work:

    intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, "en_US");

    You have to use “en_US” instead of “en-US”. The former is the right format of Java locale tag.

    It is suggested that you use

    intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, Locale.US.toString());

    to avoid remembering such detail.

    I finally got my app to restrict voice recognition results to a specified language input (handing it, e.g., “ja” for Japanese or “fr” for French) by adding all 3 of the following extras:

    String languagePref = "de";//or, whatever iso code...
    intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, languagePref);
    intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE, languagePref); 
    intent.putExtra(RecognizerIntent.EXTRA_ONLY_RETURN_LANGUAGE_PREFERENCE, languagePref);

    Hope this helps someone.

    I used this code:

    intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, "en-US");

    Hope you can run your app now.

    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.