java - Calling activity method in custom adapter class -


so trying refresh recyclerview in activity problem doesn't casting or way calling it.

any ideas?

from crashlog, appear passing applicationcontext recyclerview. instead, need pass activity context, , ensure activity implements userrview interface.

a cleaner way pass context , pass userrview adapter, not have cast context userrview, , can continue pass application context if prefer.

edit: replace code

adapter = new customradapter(list, getbasecontext()); 

with

adapter = new customradapter(list, this); 

Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -