首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

speech recognition中施用PendingIntent

2012-08-08 
speech recognition中使用PendingIntenthttp://stackoverflow.com/questions/4530472/widget-that-calls-s

speech recognition中使用PendingIntent

http://stackoverflow.com/questions/4530472/widget-that-calls-speech-recognition-app

http://stackoverflow.com/questions/6466328/recognizerintent-how-to-add-a-bundle-to-a-pending-intent

?

// this intent points to activity that should handle resultsIntent activityIntent = new Intent(context, ResultsActivity.class);// this intent wraps results activity intentPendingIntent resultsPendingIntent = PendingIntent.getActivity(context, 0, activityIntent, 0);// this intent calls the speech recognitionIntent voiceIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);voiceIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);voiceIntent.putExtra(RecognizerIntent.EXTRA_PROMPT, "Speech recognition demo");voiceIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);voiceIntent.putExtra(RecognizerIntent.EXTRA_RESULTS_PENDINGINTENT, resultsPendingIntent);// this intent wraps voice recognition intentPendingIntent pendingIntent = PendingIntent.getActivity(context, 0, voiceIntent, 0);rv.setOnClickPendingIntent(R.id.btn, pendingIntent);
?

热点排行