How can a custom view get access to its activity?
The getContext() method in the View class returns the context that was passed on its constructor. Usually that's the Activity you want (Activity extends Context). So this probably works for you:
Java:
((Activity)getContext()).someMethod(...);
Kotlin:
(context as? Activity)?.someMethod(...)