martes, 1 de abril de 2014

Android: Getting API version programatically

int currentAPIVersion = android.os.Build.VERSION.SDK_INT;

if (currentAPIVersion >= android.os.Build.VERSION_CODES.FROYO) {
    ...
}
else{
    ...
}


Thought currentAPIVersion is an int value and you could potentially compare to an API number as an int (since the constants do match the API number) it is discouraged to do so. I hardly believe they would change something like this. But it doesn't hurt doing it this way from the start.

No hay comentarios:

Publicar un comentario