Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Target API [closed]

I try to edit some code. According to the developer note, it's a part of app in android jelly bean version. But i found a piece of code that confusing me. What does this code mean? What's happened if we don't use this or deleting this piece of code:

@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
like image 768
umamlearn Avatar asked Jul 17 '14 08:07

umamlearn


1 Answers

It's an annotation that tells the Android Lint tool that the following class or method is targeting a particular API level regardless of what is specified as the min SDK level in manifest.

Lint produces errors and warnings when you're using new functionality that is not available in the target API level. If you know what you're doing and have other mechanisms to prevent the code being run on older API levels, you can use this to suppress the lint errors and warnings.

If you remove the annotation, lint uses the manifest min SDK API level setting instead when checking the code.

http://developer.android.com/reference/android/annotation/TargetApi.html

like image 135
laalto Avatar answered Sep 23 '22 05:09

laalto