android - How to implement OnScrollistener in a fragment -
i can't seem implement/extend onscrollistener recyclerview know when recyclerview hits bottom
public class upcomingfragment extends fragment
how implement if:
implements recyclerview.onscrolllistener
and
implements onscrolllistener
give me "interface expected here" error
my build gradle module:
android { compilesdkversion 21 buildtoolsversion "21.1.2" defaultconfig { applicationid "company.com.movieapp" minsdkversion 15 targetsdkversion 21 versioncode 1 versionname "1.0" } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } } }
build grade project
buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:1.2.3' // note: not place application dependencies here; belong // in individual module build.gradle files }
}
based on docs:
https://developer.android.com/reference/android/support/v7/widget/recyclerview.onscrolllistener.html
recyclerview.onscrolllistener
abstract
.
use listener this:
private final recyclerview.onscrolllistener onscrolllistener = new recyclerview.onscrolllistener() { @override public void onscrollstatechanged(final recyclerview recyclerview, final int newstate) { // code } @override public void onscrolled(final recyclerview recyclerview, final int dx, final int dy) { // code } };
add recyclerview
:
recyclerview.addonscrolllistener(onscrolllistener);
Comments
Post a Comment