解决讨厌的警告

来源:互联网 发布:网络机柜布线图 编辑:程序博客网 时间:2024/05/01 23:44
由于android系统的版本过多,有很多修改。因此,有时我们有意无意中使用了高版本的api,而自己应用所允许运行的最低版本api并没有支持该接口时,尽管不会影响程序的使用,那讨厌的警告就会如期出现了。
那么,如何屏蔽这种类型的“无用警告”呢?我们可以在使用高版本api的代码前添加上@SuppressLint("NewApi")即可。
另,@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 yourminSdkVersion

0 0
原创粉丝点击