I start the Voice recognition activity in a non activity class (by passing in the activity) here is the code:
private static void startVoiceRecognitionActivity(
I want to be able to get the result back inside the same class and not
in the activity.
No can do, you really cant get the result without executing your activity because startActivityForResult
is bounded with your activity when the other activity is finished.
solution:
Since you have your myActivity
in your another class you can use the Intent
from it to get the result from another activity in your class where you started the VoiceRecognition
. Also make sure that you call it after the VoiceRecognition
activity is finished.
sample:
myActivity.getIntent().getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);