I have an application App1 which defines class A and uses instances of this class. What I want to achieve is - after App1 is installed on the device to be able to load App2 which defines and implements class B which is subclass of class A (imported from App1 package); and be able to get an instance of class B in the App1. Class B doesn't add any new interfaces, so using it as class A is ok. But I am not sure how to pass the instance of class B to App1 (preferrably without any user interaction).
Can anyone advise if this is feasible?
Taken literally, it is impossible. App1 and App2 will be running on different virtual machines, probably in different processes. There is no way to transport an object between them, any more than you can transport a Java object between an applet and a JavaEE server.
Your options:
Parceable
andIntent
extras, effectively giving you "pass by value" between apps