I've found the R.string
pretty awesome for keeping hardcoded strings out of my code, and I'd like to keep using it in a utility class that works with models in my application to generate output. For instance, in this case I am generating an email from a model outside of the activity.
Is it possible to use getString
outside a Context
or Activity
? I suppose I could pass in the current activity, but it seems unnecessary. Please correct me if I'm wrong!
Edit: Can we access the resources without using Context
?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…