String str = getName("Network", getActivity().getResources(), getActivity().getPackageName());
private static String getName(final String attribute, final Resources res, final String packageName) {
// dynamically search for a translation of the attribute
final int id = res.getIdentifier(attribute, "string", packageName);
if (id > 0) {
final String translated = res.getString(id);
// if (StringUtils.isNotBlank(translated))
{
return translated;
}
}
return attribute;
}
댓글 없음:
댓글 쓰기