Friday, December 2, 2011

Start Voice Command using Intent of ACTION_VOICE_COMMAND

Start Voice Command using Intent of ACTION_VOICE_COMMAND

package com.exercise.AndroidVoiceCommand;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class AndroidVoiceCommandActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

Button startVoiceCommand = (Button)findViewById(R.id.startvoicecommand);
startVoiceCommand.setOnClickListener(new Button.OnClickListener(){

@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
Intent intent = new Intent(Intent.ACTION_VOICE_COMMAND);
startActivity(intent);
}});
}
}

No comments:

Post a Comment