As this question noted, and a little testing that I did, android.os.Build.VERSION_CODESworks on versions of platforms that are older than the version of the platform VERSION_CODEyou are using.
eg. this:
android.os.Build.VERSION_CODES.HONEYCOMB
Also works on Gingerbread devices, although Honecomb was released after Gingerbread.
This seems to work only if your target SDK is later than the used VERSION_CODE, which leads me to assume that the version code was somehow compiled into the APK from the target SDK.
Now, my question is:
How it works? According to the accepted answer of a related question, this works through int alias, but Java does not seem to support aliases.
source
share