protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Main); toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); SupportActionBar.Title = "Voice Assistant"; annotationTextView = FindViewById <TextView>(Resource.Id.annotationTextView); speechTextView = FindViewById <TextView>(Resource.Id.speechTextView); speechIntentTextView = FindViewById <TextView>(Resource.Id.speechIntentTextView); speechStateTextView = FindViewById <TextView>(Resource.Id.speechActionTextView); progressBar = FindViewById <ProgressBar>(Resource.Id.progressBar); toggleButton = FindViewById <ToggleButton>(Resource.Id.toggleButton); progressBar.Visibility = ViewStates.Invisible; random = new System.Random(); speech = SpeechRecognizer.CreateSpeechRecognizer(this); Log.Debug(LOG_TAG, "IsRecognitionAvailable: " + SpeechRecognizer.IsRecognitionAvailable(this)); speech.SetRecognitionListener(this); tts = new TextToSpeech(this, this, "com.google.android.com"); locale = new Locale("ru"); recognizerIntent = new Intent(RecognizerIntent.ActionRecognizeSpeech); recognizerIntent.PutExtra(RecognizerIntent.ExtraLanguagePreference, "ru"); recognizerIntent.PutExtra(RecognizerIntent.ExtraSpeechInputCompleteSilenceLengthMillis, 1500); recognizerIntent.PutExtra(RecognizerIntent.ExtraSpeechInputPossiblyCompleteSilenceLengthMillis, 1500); recognizerIntent.PutExtra(RecognizerIntent.ExtraSpeechInputMinimumLengthMillis, 5000); recognizerIntent.PutExtra(RecognizerIntent.ExtraLanguageModel, RecognizerIntent.LanguageModelFreeForm); recognizerIntent.PutExtra(RecognizerIntent.ExtraMaxResults, 3); toggleButton.CheckedChange += ToggleButton_CheckedChange; }