How to get string values using this,right now it return integer value.
getApplicationContext(),getResources().getIdentifier("Please_Try_Again_"+nativeLocaleSymbol, "string", getPackageName());
getIdentifier returns the resource identifier that why it is an int. Using the id you can get the resource
int resId = getApplicationContext().getResources().getIdentifier("Please_Try_Again_"+nativeLocaleSymbol, "string", getPackageName());
getApplicationContext().getResources().getString(resId)
You can add this code to your application
/**
* Returns value of String from Android String identifier
*
* @param id
* Android String identifier
* @return Value of String identifier if argument is valid Android String
* identifier, same String passed in argument if not.
*/
public static String getStringByFullIdentifier(final Context context,
final String fullId) {
String ret = fullId;
final String id = StringHelper.getStringIdentifier(fullId);
if (id != null) {
ret = StringHelper.getStringByName(context, id);
}
return ret;
}
/**
* Returns string resource by name. Consider using
* {@link #getStringByName(String)} instead.
*/
public static String getStringByName(final Context context,
final String name) {
final int intId = context.getResources().getIdentifier(name, "string",
context.getPackageName());
String result = null;
try {
result = context.getString(intId);
} catch (final NotFoundException e) {
result = name;
}
return result;
}