Since you don’t have a code posted, I have to guess.
Instead of using this
keyword, try to use MainActivity.this
.
If you have a subclass in your activity, you will most likely use the context of the running activity.
1
solved cant add ImageView in a subclass [closed]