我已经在我的项目中实现了谷歌语音识别 .
我'm using this example ' http://www.learn2crack.com/2013/12/android-speech-recognition-example.html'

我已经实现了此代码来启动谷歌语音识别 .

Start.setOnClickListener(new OnClickListener() {
        @Override
         public void onClick(View v) {
            if(isConnected()){
             Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
             intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
             RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
             startActivityForResult(intent, REQUEST_CODE);
                     }
            else{
                Toast.makeText(getApplicationContext(), "Plese Connect to Internet", Toast.LENGTH_LONG).show();
            }}

        });

接下来当我在Galaxy S6上运行时,会弹出谷歌语音识别 . 但在我说出语音识别之后 . 该应用程序将终止 .

这是我正在使用的示例中的一些其他代码 . 在此代码中,他返回了不同文本的列表 . 但我想做的是,当我说'按钮1'按钮1动作将开始 .

@Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
     if (requestCode == REQUEST_CODE && resultCode == RESULT_OK) {

     match_text_dialog = new Dialog(MainActivity.this);
     match_text_dialog.setContentView(R.layout.dialog_matches_frag);
     match_text_dialog.setTitle("Select Matching Text");
     textlist = (ListView)match_text_dialog.findViewById(R.id.list);
     matches_text = data
             .getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
     ArrayAdapter<String> adapter =    new ArrayAdapter<String>(this,
             android.R.layout.simple_list_item_1, matches_text);
     textlist.setAdapter(adapter);
     textlist.setOnItemClickListener(new AdapterView.OnItemClickListener() {
     @Override
     public void onItemClick(AdapterView<?> parent, View view,
                             int position, long id) {
         Speech.setText("You have said " +matches_text.get(position));
         match_text_dialog.hide();
     }
 });
     match_text_dialog.show();

     }
     super.onActivityResult(requestCode, resultCode, data);
    }