Android @suppress Errors Vs @targetapi
Solution 1:
@TargetApi(NN)
says "Hey, Android! Yes, I know I am using something newer than what is allowed for in my android:minSdkVersion
. That's OK, though, 'cause I am sure that I am using Build
(or something) such that the newer code only runs on newer devices. Please pretend that my minSdkVersion
is NN
for the purposes of this (class|method)".
@SuppressLint
, to address the same error, says "Hey, Android! Yes, I know I am using something newer than what is allowed for in my android:minSdkVersion
. Quit complaining.".
Hence, given a choice of @TargetApi(NN)
or @SuppressLint
, go with @TargetApi(NN)
. There, if you start using something newer than NN
-- and therefore your existing version-checking logic may be insufficient -- you will get yelled at again.
Post a Comment for "Android @suppress Errors Vs @targetapi"