java - private static final String not doing its job -
i have implemented global private static final string key this:
private static final string key_stufe = "stufe"; to use easypreferences.
when type hardcoded string
int abc = prefs.getint("mykey", 1); the code works fine.
but when use global key:
int abc = prefs.getint(key_stufe, 1); java.lang.classcastexception: java.lang.string cannot cast java.lang.integer
i not error. global key defined string , functions expects string. fine good. why such error?
from documentation of getint method:
throws classcastexception if there preference name not int.
this happens here, key "stufe" not have int value associated.
Comments
Post a Comment