简体   繁体   English

Android:Java方法类型的API级别25,如果未调用会引起问题?

[英]Android: java method type API level 25, cause issue if not called?

This class is shared between java and android. 此类在java和android之间共享。

public class Foo {
    ....
    javax.sql.DataSource getDataSource() {
        ....
    }


}

The DataSource class on android requires API level 25. But the method getDataSource() will not be called on android. android上的DataSource类需要API级别25。但是在Android上不会调用getDataSource()方法。 Will this cause problem on android with API level < 25? 这会在API级别<25的android上引起问题吗?

This will not make any error on compiling time. 这不会在编译时出错。 So in my opinion if you never use it, it won't cause problem. 因此,我认为,即使您从不使用它,也不会造成问题。

Erase never called code, but no, there's no RuntimeExceptions if you DON'T call newer API codes trough code. 擦除从未调用过的代码,但是,如果您不调用较新的API代码通过代码,则不会有RuntimeExceptions。

Please note, that when implementing interfaces the API may try to use the methods for you. 请注意,在实现接口时,API可能会尝试为您使用这些方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Broadcastreceiver无法在android Nougat API 25级中工作吗? - Broadcastreceiver not working in android Nougat api level 25? Java错误api级别方法 - Java error api level method 如何在Android API 25级及以下级别中使用Reflection API getParameters? - How do I Use Reflection API getParameters in Android API level 25 and Below? Android API级别23中的ISO 8601问题 - Issue with ISO 8601 in Android API level 23 如何修复 Android 中的“呼叫需要 API 级别 26(当前最小值为 25)”错误 - How to fix "Call requires API level 26 (current min is 25) " error in Android Android:覆盖更高API级的方法 - Android: Override a method in higher API level 在Java中调用的这种方法覆盖是什么? - What is this type of method overriding called in Java? Intent.ACTION_CALL 不适用于 API 级别 25 及以下 - Intent.ACTION_CALL not working for API Level 25 and below Java在多个层次结构中继承的Fluent方法返回类型 - Java inherited Fluent method return type in multiple level hierarchies 有什么方法可以在 api 25 级下执行类似“requestDismissKeyGuard”的操作吗? - Is there any way to do something like `requestDismissKeyGuard` under api level 25?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM