private async Task <int> listenRequest() { _speech = SpeechRecognizer.CreateSpeechRecognizer(_context); _speech.SetRecognitionListener(this); _tcs = new TaskCompletionSource <Java.Lang.Object>(); try{ _speech.StartListening(_stt.IntentSTT()); } catch (Exception e) {} return((int)await _tcs.Task); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.STT_Layout); Button btn_ins = (Button)FindViewById(Resource.Id.btn_ins); Button btn_listen = (Button)FindViewById(Resource.Id.btn_lis); TextView txt_view = (TextView)FindViewById(Resource.Id.txt_view); // Create your application here btn_ins.Click += delegate { _stt = STTLib.Instance(); }; btn_listen.Click += delegate { //StartActivityForResult(_stt.IntentSTT(),0); SpeechRecognizer speech = SpeechRecognizer.CreateSpeechRecognizer(this); speech.SetRecognitionListener(this); speech.StartListening(_stt.IntentSTT()); }; }