I am using recycler view in fragment. In adapter i am setting the data based on the position. Once if i reach end of the listi mean last item. User is trying to scroll down ,then i have to display one toast message like there is no new feed . How to do it ?
Thanks in advance.
Define public static boolean reachedLastItem=false
In MainActivity's onCreate method write
if(reachedLastItem){
displaytoast;
reachedLastItem=false;
}
And in getView of adapter
if(index==getCount)
MainActivity.reachedLastItem=true;
Try this sample code. Please let me know in case of any help
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.