I followed the example from this site to eliminate the issues with static vs non static methods.
public static void startVoiceRecognitionActivity() {
Log.d("Buttons","Start voice called in buttons");
Buttons demo = new Buttons();
Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
intent.putExtra(RecognizerIntent.EXTRA_PROMPT, "Voice recognition Demo...");
Log.d("Buttons","Intent to start the command is: " +intent);
demo.startActivityForResult(intent,VOICE_RECOGNITION_REQUEST_CODE);
}
This code works in the main activity but the demo.startActivityForResult(intent,VOICE_RECOGNITION_REQUEST_CODE);
generates the following error in the "Buttons" service class:
The method startActivityForResult(Intent, int) is undefined for the type Buttons
Can anyone clue me into what I'm doing wrong?
Thanks!