Your activity extends class android.app.Activity which in turn extends class android.content.Context (three levels up the class hierarchy). Class Context
declares the abstract method getResources() which means that your activity subclass inherits that method and you can call it from within your onCreate()
method (for example).
The method getResources()
is declared as abstract in class Context
but one of the intermediate classes in the class hierarchy (android.view.ContextThemeWrapper) provides an implementation for the method.
Also that means that creating the Resources
object is not your responsibility; it is done by the framework instead.