How to get exact events of scrolled to top and bottom in scrollview
<p>I tried many ways explained around here on stackoverflow.But i am still not able to perfectly get each of the events in scrollview.</p>

<p>What i intend to do is change text in an edittext (wrapped inside scrollview) when top or bottom is reached so that large files can be loaded.</p>

<pre><code>        public void onScrollChange(View v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) {
            View view = (View) scrollView.getChildAt(scrollView.getChildCount() - 1);
            int diff = (view.getBottom() - (scrollView.getHeight() + scrollView.getScrollY()));

            // if diff is zero, then the bottom has been reached
            if (diff == 0) {
                if(index&lt;texts.size()-1){
                    scrollView.scrollTo(0,0);
                    index++;
                    mInput.setText(texts.get(index));
                }
            }
                // do stuff similarly for top position reached
        }
</code></pre>