SharedPreferences are related to context.
You can only reference it through a context.
You can simply pass context as a parameter to your class.
For example in the constructor.
In your activity do:
MyClass myClass = new MyClass(this);
SharedPreferences are related to context.
You can only reference it through a context.
You can simply pass context as a parameter to your class.
For example in the constructor.
In your activity do:
MyClass myClass = new MyClass(this);