Make API level specific method calls more readable
When calling methods that require a specific API level, there is a widely spread pattern to do so:
if (Build.VERSION.SDK_INT > requiredApiLevel) {
//api level specific code
}
You can also use the built in VERSION_CODES for this:
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.HONEYCOMB) {
//api level specific code
}
Written by Benjamin Weiss
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Android
Authors
Related Tags
#android
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#