I don’t really get the idea behind how this whole thing works really, so if I have some class A that need the context of a class B which extends Activity, how do i get that context?
I’m searching for a more efficient way than giving the context as a parameter to class A constructor. For example if class A is going to have millions of instances then we would end up having millions of redundant pointer to Context while we should be able somehow to have just one somewhere and a getter function…
You can use
Applicationclass(public class in android.application package),that is:To use this class do:
In your manifest:
In Activity B:
In class A:
Note: