Android 语音识别
来源:互联网 发布:低风险网络基金产品 编辑:程序博客网 时间:2024/06/05 19:14
1,判断是否支持语音识别
imagebtn = (ImageButton)findViewById(R.id.imageBtn01); imagebtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub try{ Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH); intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM); //设置为当前手机的语言类型 intent.putExtra(RecognizerIntent.EXTRA_PROMPT, "请说话,我识别");//出现语言识别界面上面需要显示的提示 startActivityForResult(intent,REQUEST_CODE); }catch(ActivityNotFoundException e){ e.printStackTrace(); Toast.makeText(MianActivity.this , "找不到语音设备", Toast.LENGTH_SHORT).show(); } } });
2,启动语音识别
ArrayList<String> results= data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS); //listView.setAdapter(new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,list)); //把数据显示在listview中 String resultsString = ""; resultsString =resultsString+results.get(0);
3,获取识别结果,并以Toast显示出来
Toast.makeText(MianActivity.this, resultsString, Toast.LENGTH_SHORT).show(); super.onActivityResult(requestCode, resultCode,data);
本文出自 “卡布奇诺” 博客,请务必保留此出处http://tianxiaoyong.blog.51cto.com/6962715/1228145
- android 语音识别接口
- android语音识别简介
- Android语音识别
- android语音识别代码
- android 本地语音识别
- android 语音识别
- android 语音识别
- Android-语音识别
- Android 语音识别
- Android 实现语音识别
- android 语音识别
- android语音识别demo
- android 语音识别
- android语音识别技术
- Android实现语音识别
- Android语音识别
- Android语音识别
- android 语音识别接口
- QT布局
- Eclipse的安装与汉化
- 经常忘记windws和linux中调用JAVA的class的区别,记录一下。
- Android开发插件的下载与安装
- Android开发学习入门Hello World
- Android 语音识别
- 计算机科学中最重要的32个算法
- Python环境搭建
- 选择排序(C++实现)
- 编辑第一个Python程序
- 关于ASCii Unicode字符编码原理
- 《这就是搜索引擎:核心技术详解》---读后感
- Android Http get和post请求,URLConnection以及Cookie的处理
- 秋意浓