Skip to content

Instantly share code, notes, and snippets.

Last active Jun 13, 2016
What would you like to do?
#android Get Resources
// String resource. normal method
// Get resources dynamically. When string variable is different in some cases
String variable = ruta.getDescripcion(); //For example, now variable is "car_description"
int intVariableForTranslate = context.getResources().getIdentifier(variable, "string", context.getPackageName());
String descriptionTranslated = context.getString(intVariableForTranslate);
// String resource
String myString = getResources().getString(R.string.mystring)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment