0
votes

I want to split the loading of elements in a ListView I know that I need to implement an OnScrollListener but there is no such class... Only IOnScrollListener which is missing the OnScrollMethod... Has anyone tryied doing so in MonoDroid? It looks pretty simple in android but I can seem to figure out how to port that code to MonoDroid and MvxListView...

Thanks

Amit

2
Why not use the C# Events instead of a ugly Java callback method? - Cheesebaron

2 Answers

1
votes

Cheesebaron's comment is the correct answer - I was having an issue myself with the IOnScrollListener (not firing at all), on this exact same problem.

I switched to using the ListView.ScrollStateChanged event instead. My code looks like this, I'm sure you can implement it your own way (_caseTable is my ListView):

            _caseTable.ScrollStateChanged += (o, e) =>
                                                 {
                                                     var adapter = (CaseListAdapter)_caseTable.Adapter;
                                                     if (e.ScrollState != ScrollState.Idle)
                                                     {
                                                         adapter.IsScrolling = true;
                                                     }
                                                     else
                                                     {
                                                         adapter.IsScrolling = false;
                                                         adapter.NotifyDataSetChanged();
                                                     }
                                                 };
0
votes

Not sure what you mean by not MISSING these are the functions you have to implement for AbsListView.IOnScrollListener

public class test: AbsListView.IOnScrollListener
{

    public void OnScroll (AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount)
    {
        throw new NotImplementedException ();
    }

    public void OnScrollStateChanged (AbsListView view, ScrollState scrollState)
    {
        throw new NotImplementedException ();
    }
    public void Dispose ()
    {
        throw new NotImplementedException ();
    }
    public IntPtr Handle {
            get { 
                return new IntPtr ();
            }
    }

}