Is it possible to load activities from an external dex-file? I'm thinking of some plug-in style-architecture, where an application can be extended by downloading dex-files with activities and classes containing extra functionality.
I've managed to load and invoke methods on a class from a downloaded dex-file using DexClassLoader and reflection. But could I somehow use this technique to present download and present an Activity? Is it possible to register this new Activity programmatically so that I can invoke it using an Intent?
I know that it's possible (and the recommended way is) to install the other Activity through the normal procedure with an APK, and then load it from my main activity using Intents or simply update the installed application, but I want to extend my already installed application by downloading some extra classes and execute everything in the same VM, same san开发者_StackOverflow中文版dbox.
Hm, let me know if you don't understand what I mean, cause this got a bit messy.. :)
If you sign your APK using the same key, you can arrange so that all your applications to share UID, process, and VM. Don't try to dynamically load .dex files yourself, it gets messy real fast.
You can use classloader from createpackagecontext to load classes from another apk.
精彩评论