Skip to content
Advertisement

Tag: custom-view

Getting MainActivity context in CustomView class

I have 2 classes: MainActivity and CustomView. I have an XML layout with this CustomView. I want to access all my MainActivity variables from my CustomView class and also to modify them, I tried to get the context but it didn’t work. MainActivity class: MyCustomView class: I also tried getContext which didn’t work. Answer By trying to access variables from

Advertisement