android get sdk version 1

android get sdk version

if(android.os.Build.VERSION.SDK_INT ==  android.os.Build.VERSION_CODES.LOLLIPOP){
	// Code For Android Version higher equal to LOLLIPOP(21)
} else if(android.os.Build.VERSION.SDK_INT > 21){
	// Code For Android Version higher than LOLLIPOP(21)
} else{
	// Code For Android Version lower than LOLLIPOP(21)
}

Here is what the above code is Doing:
1. If the Android version is equal to LOLLIPOP(21), then the code inside the first if block will be executed.
2. If the Android version is higher than LOLLIPOP(21), then the code inside the second if block will be executed.
3. If the Android version is lower than LOLLIPOP(21), then the code inside the else block will be executed.

Similar Posts