I\'m trying to create a widget that contains a single ImageView which, when clicked, starts speech recognition application. I\'ve never worked with widgets and pending inten
I encounter the same problem, too.
Sorry that I don't have enough reputation to comment.
There's no need to use a transparent activity to send a recognition intent.
Like the answer of zorglub76
Intent 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);
The recognition result will just be in the extra of the resultingPendingIntent
So all you need to do is:
In ResultsActivity.onCreate()
ArrayList voiceResults = this.getIntent().getExtras().getStringArrayList(RecognizerIntent.EXTRA_RESULTS);
Be care of the NullPointerException
, and you'll get the result from the ArrayList!!