kgnzpk kgnzpk - 4 months ago 139
Java Question

Android get context from non Activity Class

I m creating an open source library for android in this library I should call a method on application start. After this method call I need to get context. Is there a way to get current context or activity from a static class without pass Context parameter to method. Is android send an intent when an activity start.


Pass an Instance of Context via Constructor

class YourClass {
    private Context context;

    public YourClass(Context context) {