TalkBot.MainActivity.OnCreate C# (CSharp) Method

OnCreate() protected method

protected OnCreate ( Bundle bundle ) : void
bundle Bundle
return void
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            SetContentView (Resource.Layout.Main);

            textToSpeak = FindViewById<EditText> (Resource.Id.textToSpeak);
            speechButton = FindViewById<Button> (Resource.Id.speechButton);
            speechItemListView = FindViewById<ListView> (Resource.Id.speechItemListView);

            speech = new TextToSpeech (this, this);
                        speech.SetLanguage (Java.Util.Locale.Default); //translate to default locale

            speechButton.Click += (object sender, EventArgs e) => {

                string text = textToSpeak.Text;

                if (!String.IsNullOrEmpty (text)) {
                    speech.Speak (text, QueueMode.Add, null);
                } else {
                                        Toast.MakeText (this, Resource.String.enter_text_to_speak, ToastLength.Short).Show ();
                }
            };

            speechItemListView.ChoiceMode = ChoiceMode.Single;

            if (speechItemListView != null) {
                speechItemListView.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) => {
                    textToSpeak.Text = items [e.Position];
                    speechItemListView.SetSelection (e.Position);
                                        this.InvalidateOptionsMenu ();
                };
            }

                        textToSpeak.TextChanged += (sender, e) => this.InvalidateOptionsMenu();
        }