I need to develop a voice recognition app which works for customized
language( input by the user) through CODE.

 I have tried the following code snippets but in this case it detects
not only French but randomly English and French.

 public void onCreate(Bundle savedInstanceState) {
Locale.setDefault(Locale.FRANCE);

    Configuration config = new Configuration();

    config.locale = Locale.FRANCE;

    getBaseContext().getResources().updateConfiguration(config,

    getBaseContext().getResources().getDisplayMetrics());
}


  private void startVoiceRecognitionActivity() {
        
        Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
        intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
                RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
        intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, "fr");
        intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE,"fr");
        
intent.putExtra(RecognizerIntent.EXTRA_ONLY_RETURN_LANGUAGE_PREFERENCE,"fr");

        intent.putExtra(RecognizerIntent.EXTRA_PROMPT, "Speech
recognition demo");
        startActivityForResult(intent, VOICE_RECOGNITION_REQUEST_CODE);
    }

Please correct in case of any errors.
Can anyone suggest any method for changing voice recognition language
through code.
Thanks

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to