我找到了一个旅行" Android Text To Speech JNI Translation"在论坛中。但我想将语音转换为文本,与#34; Voice Recognize"相同。 。 然后我在下面有几个代码:
{ TForm1.TRecognitionListener }
constructor TForm1.TRecognitionListener.Create(AParent: TForm1);
begin
inherited Create;
FParent := AParent;
end;
procedure TForm1.ButtonInitSpeechClick(Sender: TObject);
var
b : Boolean;
begin
b := TJSpeechRecognizer.JavaClass.isRecognitionAvailable(SharedActivityContext);
if b then
begin
SpeechRecognizer := TJSpeechRecognizer.JavaClass.createSpeechRecognizer(SharedActivityContext);
RecListener := TRecognitionListener.Create(self);
RecognizerIntent := TJRecognizerIntent.JavaClass.getVoiceDetailsIntent(SharedActivityContext);
RecognizerIntent.putExtra(TJRecognizerIntent.JavaClass.EXTRA_LANGUAGE_MODEL, StringToJString('en-US'));
SpeechRecognizer.setRecognitionListener(RecListener);
end;
end;
它有bug:" SpeechRecognize应该来自应用程序的主要内容" 这就是全部; Plz告诉我是什么原因?以及如何解决它。