简体   繁体   English

如何设置要在桌面应用程序和Android App中使用的Java库

[英]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.

相关问题 如何隐藏使用Java桌面应用程序构建并由Android应用程序使用的文件的内容? - How can i conceal the content of a file that is constructed using a Java desktop application and used by an Android app? 如何在Java中将桌面应用程序转换为Web应用程序 - how to make my desktop application to web app application in java 如何设置我的Java应用程序中的所有jtooltips使用的CSS? - How to set a CSS to be used by all jtooltips in my Java application? 如何将我的Java项目转换为桌面应用程序? - How to convert my Java project into a Desktop Application? 如何在 windows7、8 中设置我的 java 应用程序的桌面图标? - How i can set Desktop Icon of my java Application in windows7, 8? 适用于Java桌面和Android的剪贴板库? - Clipboard library for java desktop and android? 从 Java 桌面应用程序为 Android 应用程序运行 Gradle 构建脚本 - Running Gradle Build Script from Java Desktop Application for Android App 如何将我的 Java 桌面和 mysql 数据库应用程序放入我的网站 - How to put my Java desktop and mysql database application into my website 如何从桌面Java使用Android语音识别库 - How to use Android Speech Recognition Library from desktop java 如何在Java桌面应用程序中的Crystal Reports上设置参数 - How to set parameter on Crystal Reports in java desktop application
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM