Skip to content
Advertisement

how to call getResouces() in a class that is not extended Activity?

I would like to call getResouces in some classes, however, these classes are not extended to Activity. How to do it in a right way?

Advertisement

Answer

You can pass in a pointer to your activity from which you should call getApplicationContext(). In certain cases you would want to use the regular getContext().

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement