简体   繁体   中英

If we reach end of the listview, again i am trying scroll down to load more data. So how to give toast message to the user in android?

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM