Search code examples
xamarinxamarin.androidautocompletetextview

How to get/set text value of AutoCompleteTextView in Xamarin?


This problem looks trivial but I can't find solution for Xamarin.


Solution

  • AutoCompleteTextView extends the EditText class so you should be able to get and set the text just by playing around with the Text property like this:

    var autocompleteTextView = FindViewById<AutoCompleteTextView>(Resource.Id.AutoCompleteInput);
    string currentText = autocompleteTextView.Text;
    autocompleteTextView.Text = "New text";