[英]How to set my java library to be used in desktop application and Android App
Is there any method (preferred an annotation) to find if my library was used in Desktop Application or Android App, Wherein I have a method that works fine in Desktop Apps, but in Android Apps it just works for API Level 19 and above, so when I typed @TargetApi(19)
on the function it cause an ERROR while @TargetApi()
is not found in Desktop Application. 是否有任何方法(最好使用注释)来查找我的库是在桌面应用程序还是Android应用程序中使用的,其中我有一种方法可以在桌面应用程序中正常工作,但是在Android应用程序中它仅适用于API级别19及以上,因此当我在函数上键入
@TargetApi(19)
时,在桌面应用程序中找不到@TargetApi()
时会导致错误。 Is there any function to achieve this. 有什么功能可以做到这一点。
您可以在Android应用中使用if (android.os.Build.VERSION.SDK_INT >= 19) { ... }
来调用依赖于Api 19+的函数
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.