As pargat says, this will do this:
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, "en-US");
In addition, your application can request a list of supported languages by sending an ordered broadcast of RecognizerIntent.ACTION_GET_LANGUAGE_DETAILS like this:
Intent detailsIntent = new Intent(RecognizerIntent.ACTION_GET_LANGUAGE_DETAILS); sendOrderedBroadcast( detailsIntent, null, new LanguageDetailsChecker(), null, Activity.RESULT_OK, null, null);
where LanguageDetailsChecker looks something like this:
public class LanguageDetailsChecker extends BroadcastReceiver { private List<String> supportedLanguages; private String languagePreference; @Override public void onReceive(Context context, Intent intent) { Bundle results = getResultExtras(true); if (results.containsKey(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE)) { languagePreference = results.getString(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE); } if (results.containsKey(RecognizerIntent.EXTRA_SUPPORTED_LANGUAGES)) { supportedLanguages = results.getStringArrayList( RecognizerIntent.EXTRA_SUPPORTED_LANGUAGES); } } }
For complete code check this github project: https://github.com/gast-lib
gregm May 11 '12 at 9:17 2012-05-11 09:17
source share