You have a few options here:
- Pass
Context
as an argument to FeedAdapter and keep it as class field - Use dependency injection to inject
Context
when you need it. I strongly suggest reading about it. There is a great tool for that — Dagger by Square -
Get it from any
View
object. In your case this might work for you:holder.pub_image.getContext()
As
pub_image
is aImageView
.