Android – How to check the system version of Android

androidsystemversion

Does anyone know how can I check the system version (e.g. 1.0, 2.2, etc.) programatically?

Best Solution

Example how to use it:

if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.GINGERBREAD) {
     // only for gingerbread and newer versions
}