From 0201edaa307c4740e7f547a7c2cb4f83a02d56bb Mon Sep 17 00:00:00 2001 From: Libby Baldwin Date: Sun, 12 Feb 2012 16:37:21 -0800 Subject: [PATCH] support Android 2.1-2.3.0 and fix up readme js example --- Android/SpeechRecognizer/README.md | 2 +- Android/SpeechRecognizer/SpeechRecognizer.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Android/SpeechRecognizer/README.md b/Android/SpeechRecognizer/README.md index 8630e10..db5571f 100644 --- a/Android/SpeechRecognizer/README.md +++ b/Android/SpeechRecognizer/README.md @@ -43,7 +43,7 @@ function speechOk(result) { requestCode = respObj.speechMatches.requestCode; for (match in respObj.speechMatches.speechMatch) { - console.log("possible match: " + match); + console.log("possible match: " + respObj.speechMatches.speechMatch[match]); // regex comes in handy for dealing with these match strings } } diff --git a/Android/SpeechRecognizer/SpeechRecognizer.java b/Android/SpeechRecognizer/SpeechRecognizer.java index 642b376..f57686e 100644 --- a/Android/SpeechRecognizer/SpeechRecognizer.java +++ b/Android/SpeechRecognizer/SpeechRecognizer.java @@ -57,7 +57,7 @@ public class SpeechRecognizer extends Plugin { if (!recognizerPresent) { return new PluginResult(PluginResult.Status.ERROR, NOT_PRESENT_MESSAGE); } - if (!this.speechRecognizerCallbackId.isEmpty()) { + if (!(this.speechRecognizerCallbackId.length() == 0)) { return new PluginResult(PluginResult.Status.ERROR, "Speech recognition is in progress."); } @@ -125,7 +125,7 @@ public class SpeechRecognizer extends Plugin { intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM); if (maxMatches > 0) intent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, maxMatches); - if (!prompt.isEmpty()) + if (!(prompt.length() == 0)) intent.putExtra(RecognizerIntent.EXTRA_PROMPT, prompt); ctx.startActivityForResult(this, intent, reqCode); }