Hello,
I am creating a library to interface to Google's Speech Recognizer. I know it's been done before, but I'd like to give it a try.
In the Recognizer Listener Java library code, I have the following:
Where MyLogMsg just returns a message via an Event that can be logged.
My question concerns: ArrayList<String> data. When I raiseEvent I pass the ArrayList data. How would this be received by B4A?
Would the following B4A code be correct?
Or, what would be the best way to return the Results from Java?
Thanks,
Barry.
I am creating a library to interface to Google's Speech Recognizer. I know it's been done before, but I'd like to give it a try.
In the Recognizer Listener Java library code, I have the following:
B4X:
public void onResults(Bundle results) {
MyLogMsg("onResults " + results);
ArrayList<String> data = results.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION);
for (int i = 0; i < data.size(); i++) {
MyLogMsg(" i:" + String.valueOf(i) + ", " + data.get(i));
}
if (ba.subExists(eventName + "_finalresult"))
ba.raiseEvent(null, eventName + "_finalresult", data);
}
}
Where MyLogMsg just returns a message via an Event that can be logged.
My question concerns: ArrayList<String> data. When I raiseEvent I pass the ArrayList data. How would this be received by B4A?
Would the following B4A code be correct?
B4X:
Sub CRGVR_Results(Res as List)
For Each str As String in Res
Log(str)
Next
end sub
Or, what would be the best way to return the Results from Java?
Thanks,
Barry.