I Have created a grouped ListView which is added inside TableView, it looks fine but when i scroll the list it crashes and throws the below exception:
System.NotSupportedException: Unable to activate instance of type Xamarin.Forms.Platform.Android.ListViewAdapter from native handle.
No constructor found for Xamarin.Forms.Platform.Android.ListViewAdapter::.ctor(System.IntPtr, Android.Runtime.JniHandleOwnership)---> Java.Interop.JavaLocationException: Exception of type 'Java.Interop.JavaLocationException' was thrown.
I disabled the ListView scroll through customRenderer, like below:
=================================
protected override void OnElementChanged(ElementChangedEventArgs e)
{
base.OnElementChanged(e);
if (e.OldElement == null) {
var nativeListView = (global::Android.Widget.ListView)Control;
nativeListView.VerticalScrollBarEnabled = false;
nativeListView.SetScrollContainer (false);
}
}
But still the result is same.
and also tried with inserting constuctor in my custom listview class :
=======================================
protected MyCustomListView(IntPtr javaReference, JniHandleOwnership transfer)
: base() { }
But no use, it throws the same above exception.
my code for the UI looks like below:
List titleList = new List ();
titleList.Add ("Yes");
titleList.Add ("No");
titleList.Add ("Finally!");
foreach (var title in titleList) {
var titleSection = new TableSection {
Title = title
};
var cell = new ViewCell
{
Height = (60 * 6)
};
var inspectionTypesBasedOnCategory = new ListViewUI ()
{
};
cell.View = inspectionTypesBasedOnCategory;
titleSection.Add (cell);
TableView.Root.Add(titleSection);
}
================================
Please help me out in solving this issue, i already waste so much time tracking this issue.
or
Suggest me if there is some other best way to achieve this grouped listview part.
Thank you in advance.