public enum test7 {
TRUE {
@Override public String getRtext() {
return cnt.getString(R.string.on);
}
},
FALSE {
@Override public String getRtext() {
return cnt.getString(R.string.off);
}
};
public Context getCnt() {
return cnt;
}
public Context cnt;
public test7 getS(Context c, boolean b) {
return b ? TRUE : FALSE;
}
abstract String getRtext();
}
return test7.TRUE.getS(cnt, myTrue == GET_LOCATION_OFF).getRtext();
--
public class MainEnum {
public enum Rstring {
LOCATION_ON(getRstring(R.string.location_measure_on)),
LOCATION_OFF(getRstring(R.string.location_measure_off)) public Rstring getZoneName(boolean b) {
return b ? ZONE_UNDETECTABLE : ZONE_OUTSIDE;
}
public Rstring getLocation(boolean b) {
return b ? LOCATION_ON : LOCATION_OFF;
}
public Rstring getRequireStopTitle(boolean b) {
return b ? REQUIRE_STOP_TITLE : REQUIRE_STOP_TITLE_FOR_DEVICE_OWNER;
}
public Rstring getRequireStopMessage(boolean b) {
return b ? REQUIRE_STOP_MESSAGE : REQUIRE_STOP_MESSAGE_FOR_DEVICE_OWNER;
}
private String rString;
Rstring() {
}
Rstring(String rstring) {
this.rString = rstring;
}
public String rText() {
return rString;
}
}
private static Context cnt;
private static String getRstring(int resourceId,Object... formatArgs){
if (formatArgs != null && formatArgs.length > 0) {
return cnt.getString(resourceId, formatArgs);
}
return cnt.getString(resourceId);
}
public static void setContext(Context argcnt) {
cnt = argcnt;
}
}