Using Resources in Exceptions
<p>I have an app that uses custom Exceptions, such as this:</p>

<pre><code>public class SomeException extends Exception{
    private int         iCode;
    private String      iMessage;

    public SomeException(){
        iCode = 201;
        iMessage = **//Get the localized string R.string.error_201??**
    }


    @Override
    public String getMessage() {
        return iMessage;
    }


    @Override
    public int getCode() {
        return iCode;
    }

}
</code></pre>

<p>Obviously, I want lo localize the error message. I have possible solutions but non of them satisfy me.</p>

<p>1) Pass "Context" to the constructor, and do ctx.getString(R.string.error_201)
    --> Fail, as this Exceptions are sometimes thrown from MODEL classes, so they don't have a Context</p>

<p>2) Pass "Context" when retriveing the message in getMessage() function,
    --> Fail, It's necesary to override the super method, to work as all other Exceptions.</p>

<p>Solution I have now: All activities in my app have this onCreate:</p>

<pre><code>public void onCreate(...){
    Utils.RESOURCES = getResources();
    ...
}
</code></pre>

<p>Very dirty code... I don't like the solution. My question is then,: is there a way to access the resources without the Context? And most important, How would an application such as mine solve this problem?</p>
