Is there an Enum string resource lookup pattern for Android?
问题 I have an enumeration where I need to display the values as localized strings. My current approach has been this: public enum MyEnum { VALUE1(R.string.VALUE1), VALUE2(R.string.VALUE2), . . VALUE10(R.string.VALUE10); private int mResId = -1; private MuEnum(int resId) { mResId = resId; } public String toLocalizedString(Resources r) { if (-1 != mResId) return (r.getString(mResId)); return (this.toString()); } } Is there any easier way to to do this? I'd love it if I could somehow lookup the