I want to programmatically check the current android version and execute a piece of code if the version is higher than Gingerbread but when I try to use
android.os.Build.VERSION_CODES.GINGERBREAD
eclipse is showing following error
GINGERBREAD cannot be resolved or is not a field
so what may be the reason for that?
You need to set your build target (e.g., Project > Properties > Android) to API Level 9 or higher to reference that symbol.
Nowadays, you usually want to set that build target to something fairly current (e.g., API Level 18), using Lint to point out anything that you reference that is higher than your android:minSdkVersion
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With