I have an app, that has an Activity that uses a ScrollView
. I need to detect when user gets to the bottom of the ScrollView
. I did some googleing and I found this page where is explained. But, in the example, that guys extends ScrollView
. As I said, I need to extend Activity.
So, I said "ok, let's try to make a custom class extending ScrollView
, override the onScrollChanged()
method, detect the end of the scroll, and act accordingly".
I did, but in this line:
scroll = (ScrollViewExt) findViewById(R.id.scrollView1);
it throws a java.lang.ClassCastException
. I changed the <ScrollView>
tags in my XML but, obviously, it doesn't work. My questions are: Why, if ScrollViewExt
extends ScrollView
, throws to my face a ClassCastException
? is there any way to detect end of scrolling without messing too much?
Thank you people.
EDIT: As promised, here is the piece of my XML that matters:
<ScrollView
android:id="@+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<WebView
android:id="@+id/textterms"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:textColor="@android:color/black" />
</ScrollView>
I changed it from TextView
to WebView
to be able of justifying the text inside. What i want to achieve is the "Accept button doesn't activate until the terms of the contract are fully read" thing. My extended class is called ScrollViewEx
t. If i change the tag ScrollView
for ScrollViewExt
it throws an
android.view.InflateException: Binary XML file line #44: Error inflating class ScrollViewExt
because it doesn't understand the tag ScrollViewEx
. I don't think it has a solution...
Thanks for your answers!