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

How to check data type in C++? -

javascript - Is getTimezoneOffset() stable during daylight saving transition? -

formula - R: how to pass in a reference to the variable in glm or lm? -