Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 "ClassNotFoundExpetion".

like image 619
Adem Avatar asked Dec 05 '25 22:12

Adem


2 Answers

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.

like image 145
CommonsWare Avatar answered Dec 08 '25 12:12

CommonsWare


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.

like image 20
lxgr Avatar answered Dec 08 '25 12:12

lxgr



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!