Reputation: 128
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.
Upvotes: 2
Views: 2508
Reputation: 3339
Pass an Instance of Context
via Constructor
class YourClass {
private Context context;
public YourClass(Context context) {
this.context=context;
}
}
Upvotes: 4