I have the following code that works on my main Activity but I have an extended DefaultHandler class and want to be able to access some resources.
How do I get the following to work?
Drawable newMarker = this.getResources().getDrawable(R.drawable.generic2r);
You could reference the activity context with MyActivity.this, to produce:
Drawable newMarker = MyActivity.this.getResources().getDrawable(R.drawable.generic2r);
As long as you make sure that you only need your Handler from this specific activity.
Pass the context as a parameter to Your handler.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With