I was working in an App Android using Java. I have to translate some error messages defined in a interface. However the interface don't accept atribuition of R.string resources to a constant like that
public static final String TITLE_AUTO_TEST_NOT_CONNECTED = "Connection Failed !!!";
Then I will define all contansts directely in strings.xml resources...
However, in this interface I have a HashMap code as follows:
public static Map<Integer,String> errorCodeMap= new HashMap<Integer,String>(){
{
put(ERROR_CODE_GENERIC, R.string.GENERIC_ERROR);
put(ERROR_CODE_USER_CANCEL, "User action happened !!! ");
put(ERROR_CODE_COMM_GENERIC, "Communication error happened !!! ");
put(ERROR_CODE_EXPIRED_TIMER, "Execution time expired !!! ");
put(ERROR_CODE_NETWORK_GENERIC, "Network error happened !!! "); }
};
In the first put, Java don't accept R.string because the return is int. Could anyone help me with a solution to converto to string... in this interface if possible?
Thanks in advance!