我在使用Java的App Android中工作。 我必须翻译接口中定义的一些错误消息。但是,接口不接受将R.string资源分配给类似
的常量public static final String TITLE_AUTO_TEST_NOT_CONNECTED = "Connection Failed !!!";
然后我将直接在strings.xml资源中定义所有contansts ......
但是,在这个接口中我有一个HashMap代码如下:
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 !!! "); }
};
在第一次使用中,Java不接受R.string,因为返回是int。 如果可能的话,任何人都可以帮我解决将converto转换为字符串的问题吗?
提前致谢!