Understanding @SuppressLint("NewApi") annotation Understanding @SuppressLint("NewApi") annotation android android

Understanding @SuppressLint("NewApi") annotation


@SuppressLint("NewApi") is an annotation used by the Android Lint tool.

Lint will tell you whenever something in your code isn't optimal or may crash. By passing NewApi there, you're suppressing all warnings that would tell you if you're using any API introduced after your minSdkVersion

See a full list of Lint checks - including "NewApi" - here: http://tools.android.com/tips/lint-checks


Source: click here

In addition to testing that your Android application meets its functional requirements, it's important to ensure that your code has no structural problems. Poorly structured code can impact the reliability and efficiency of your Android apps and make your code harder to maintain. For example, if your XML resource files contain unused namespaces, this takes up space and incurs unnecessary processing. Other structural issues, such as use of deprecated elements or API calls that are not supported by the target API versions, might lead to code failing to run correctly.

The Android SDK provides a code scanning tool called lint that can help you to easily identify and correct problems with the structural quality of your code, without having to execute the app or write any test cases. Each problem detected by the tool is reported with a description message and a severity level, so that you can quickly prioritize the critical improvements that need to be made. You can also configure a problem's severity level to ignore issues that are not relevant for your project, or raise the severity level. The tool has a command-line interface, so you can easily integrate it into your automated testing process.

The lint tool checks your Android project source files for potential bugs and optimization improvements for correctness, security, performance, usability, accessibility, and internationalization. You can run lint from the command-line or from the Eclipse environment.


That annotation indicates that Lint should ignore the specified warnings for the annotated element. The set of warnings (identified by the lint issue id) that should be ignored by lint. It is not an error to specify an unrecognized name.

see details: https://developer.android.com/reference/android/annotation/SuppressLint