How can I check the system version of Android?

davs picture davs · Jun 22, 2010 · Viewed 499.6k times · Source

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

Answer

ATom picture ATom · Sep 10, 2011

Example how to use it:

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