Share via

Android.Widget.ListView error in MAUI

vanKraster 201 Reputation points
2023-05-09T07:43:50.38+00:00

Hi to all,

I am trying to render a Android.Widget.ListView in Android with MAUI and it is not working.
The error is : removeAllViews() is not supported in AdapterView
Same code in Xamarin Forms is working, Custom renderer of android


        protected override void OnElementChanged(ElementChangedEventArgs<DTWheelPicker> e)
        {
            base.OnElementChanged(e);
            if (e.NewElement == null)
            {
                return;
            }
            if (e.NewElement != null)
            {
                var inflater = (global::Android.Views.LayoutInflater)this.Context.GetSystemService(global::Android.App.Service.LayoutInflaterService);
                var layout = inflater.Inflate(Resource.Layout.wheelPicker, null).JavaCast<Android.Widget.ListView>();
                SetAdapter();
                SetNativeControl(layout);
            }
        }
Developer technologies | .NET | .NET Multi-platform App UI

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.