locked
xamarin application autocomplete textbox using weather app template RRS feed

  • Question

  • User-619902713 posted

    I am using weather app template, i need autocomplete text box

    I am using example code from weather app, but not able to use below.

    https://developer.xamarin.com/recipes/android/controls/autocomplete_text_view/add_an_autocomplete_text_input/

    I need to add auto complete text box but getting error on overload when i try to add at "WeatherPage.xaml.cs"

    Get error in  ArrayAdapter  overload values this and autoCompleteOptions

    var autoCompleteOptions = new String[] { "Hello", "Hey", "Heja", "Hi", "Hola", "Bonjour", "Gday", "Goodbye", "Sayonara", "Farewell", "Adios" };
    ArrayAdapter autoCompleteAdapter = new ArrayAdapter(this,
    Android.Resource.Layout.SimpleDropDownItem1Line, autoCompleteOptions);

    Monday, January 23, 2017 10:58 AM

All replies

  • User-619902713 posted

    I am using weather app, need to add auto complete text box how can i add rather than using normal textbox

    Monday, January 23, 2017 11:38 AM
  • Monday, January 23, 2017 11:52 AM
  • User632428103 posted

    Hello rahulmehta9

    try this 

    string[] clientCountry = { "Germany", "Belgium", "French", "Holland", "Netherlands", "Luxembourg" };
                ArrayAdapter adapter = new ArrayAdapter(this, Android.Resource.Layout.SimpleDropDownItem1Line, clientCountry);
    
                //
                AutoCompleteTextView autoComplete = FindViewById<AutoCompleteTextView>(Resource.Id.AutoCompleteInput);
                autoComplete.Adapter = adapter;

    don't hesitate if it's works to ask question about xamarin (android NOT FORM) here i pratice since several month ...

    Hope this help

    Monday, February 6, 2017 6:50 PM