Click here to Skip to main content
15,867,330 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
My team is working on Xamarin Android Development. In a view I have a scrollView and i am using 'ScrollChange' event of scrollview to detect scroll movement and performing required actions. It works fine for my machine. But when i used the same code on another machine, i am getting runtime error as follows:

C#
Unhandled Exception:
Java.Lang.ClassNotFoundException: mono.android.view.View_OnScrollChangeListenerImplementor


What I have tried:

I tried to add additional class to override but all in vain. I am just wondering what can be missing in this machine to cause such issues.
Posted
Updated 29-Feb-16 20:21pm

1 solution

After spending couple of hours, i make few changes to my code and now its working fine. Earlier I was using following code to attach the delegate.

C#
ScrollView ScrollView1 = (ScrollView)FindViewById(Resource.Id.ScrollView1);
            ScrollView1.ScrollChange += ScrollView1_ScrollChange;


 private void ScrollView1_ScrollChange(object sender, EventArgs e)
        {
            ScrollView scrollView = sender as ScrollView;

            double scrollingSpace = scrollView.GetChildAt(0).Height - scrollView.Height;

            if (scrollingSpace <= scrollView.ScrollY) // Touched bottom
            {
                // Do the things you want to do
                Toast.MakeText(this, "You have reached to the bottom!", ToastLength.Short).Show();
            }
        }


Now the above code was working on almost every machine but not on all the machine. Few machines throwing the error as mentioned above.
Then i altered the delegate method params as follows:

C#
void ScrollView1_ScrollChange(object sender, View.ScrollChangeEventArgs e)


Now rest definition remains the same. Now this delegate works fine for every machine.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900