how to load class from one another application in android
is there anyway to load a class from differen application ?
for example, I have two application and one of them has SomeExample class file. and I want to load it and use from another application.
I try to use, Class.forName. but this function throws "ClassNotFoundExp开发者_运维问答etion".
Is there anyway to load a class from differen application ?
No, sorry.
You can use startActivity()
, startService()
, and so on to launch components of another application, but each application's code remains separate.
While in most cases unadvisable (Android has many APIs to solve the common problems of inter-app communication without sharing code), it's possible by using PathClassLoader.
See also Android- Using DexClassLoader to load apk file.
精彩评论