赞
踩
1 MainActivity 语音转文字
package com.sammer.xfyun; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.TextView; import com.iflytek.cloud.RecognizerListener; import com.iflytek.cloud.RecognizerResult; import com.iflytek.cloud.SpeechConstant; import com.iflytek.cloud.SpeechError; import com.iflytek.cloud.SpeechRecognizer; import com.iflytek.cloud.SpeechUtility; import org.json.JSONException; import org.json.JSONObject; import java.util.HashMap; import java.util.LinkedHashMap; public class MainActivity extends AppCompatActivity { private TextView tv_content; private HashMap<String, String> mIatResults = new LinkedHashMap<String, String>(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); tv_content = (TextView) findViewById(R.id.textView_content); SpeechUtility.createUtility(MainActivity.this, SpeechConstant.APPID + "=........."); // 这里要替换成自己申请的 AppID } public void startSpeechClick(View view){ //1.创建SpeechRecognizer对象,第二个参数:本地听写时传InitListener SpeechRecognizer mIat= SpeechRecognizer.createRecognizer(this, null); //2.设置听写参数,详见《科大讯飞
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。