开发者

android classpath

开发者 https://www.devze.com 2023-02-04 14:25 出处:网络
In standard Java, the accessible classes are the classes present in the classpath or whose containing .jar file is in the classpath.

In standard Java, the accessible classes are the classes present in the classpath or whose containing .jar file is in the classpath. By accessible, I mean that you can refer to these classes in your source code. By example, you can type


   System.out.println("hello");
because the System class (or rather its containing .jar) is in the classpath.

Is there a notion of classpath in Android ?

What are the accessible classes ?

In particular, how can I m开发者_如何学运维ake a class in an apk accessible to classes in other apks ?


You can't make a class in an APK available to other APK's per se as far as I know. But if it's your own code, you can either create a library or just add a build path (link source) to your project and then just do imports the regular way.

Sometimes it also makes sense to create providers for content you want accessible across activities.


I dont think this is possible. You can't directly call methods located in other apks. However it is possible to communicate with other APK's by using Intents.


As others have stated, you can't call a class in one apk from another.

The available classes in android can be found in the reference docs. If you have downloaded the SDK, then these are in the android.jar file found in /<SDK root>/platforms/android-<version>.


What exactly are you trying to reference? Are you trying to reference multiple classes? Ie if you trying to reference apps outside your app that is not possible. If you are trying to reference other class in your app then just make objects and reference that way.

0

精彩评论

暂无评论...
验证码 换一张
取 消