Android的目标API [英] Android Target API

查看:240
本文介绍了Android的目标API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试编辑一些code。据开发者注意到,它的应用程序在android系统果冻豆版本的一部分。但我发现了一张code,它混淆了我。这是什么code是什么意思?如果我们不使用这个发生了什么事或删除这块code的:

  @TargetApi(Build.VERSION_ codeS.HONEYCOMB_MR2)


解决方案

这是一个注解,告诉了Android lint工具下面的类或方法,无论什么被指定为清单中的最小SDK水平的针对某一特定的API级别

林特当你使用新功能所不具备在目标API级别产生错误和警告。如果你知道你在做什么,并有其他的机制,以prevent的code正在对旧的API级别上运行,你可以用它来共进晚餐preSS皮棉错误和警告。

如果您删除注释,检查code lint时使用清单分钟SDK API级别设置来代替。

<一个href=\"http://developer.android.com/reference/android/annotation/TargetApi.html\">http://developer.android.com/reference/android/annotation/TargetApi.html

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)

解决方案

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

这篇关于Android的目标API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆