讯飞语音语音听写,设置识别语言
private void initIfly() { //SpeechUtility.createUtility(getActivity(), SpeechConstant.APPID +"=5b94432a"); initListener = new InitListener() { @Override public void onInit(int code) { if (code != ErrorCode.SUCCESS) { Log.d(TAG, "对象初始化失败,错误码" + code); msgRecyclerviewAdapter.addString("" + code, true); recyclerView.scrollToPosition(MsgRecyclerviewAdapter.key.size() - 1); } else { //Log.d(TAG, "对象初始化成功,状态码" + code); } } }; speechRecognizer = SpeechRecognizer.createRecognizer(getActivity(), initListener); speechRecognizer.setParameter(SpeechConstant.DOMAIN, "iat"); // com.sun.javafx.font PrismFontFile.java // http://mscdoc.xfyun.cn/android/api/ 中的SpeechRecognizer类 boolean isCN = MultiLanguageUtil.getInstance().isChinese(); if(isCN){ speechRecognizer.setParameter(SpeechConstant.LANGUAGE,"zh_cn"); speechRecognizer.setParameter(SpeechConstant.ACCENT, "mandarin "); }else{ speechRecognizer.setParameter(SpeechConstant.LANGUAGE,"en_us"); speechRecognizer.setParameter(SpeechConstant.ACCENT, null); } }