title: Plugin system with DexClassLoader() and user interface
body: <p>For a long-term student project, i'm trying to develop a modular application with plugins. Specifically, we would have:</p>
  
  <ul>
  <li><p>A master application where we could search, update, delete and run the plugins. This master application would also store some data from plugins.</p></li>
  <li><p>Several plugins downloaded from a HTTP server with code and GUI components.</p></li>
  </ul>
  
  <p>For now, i have a master application which is able to download a .apk file from HTTP and to create a new instance from a class defined in this .apk file. I use the way described here: <a href="http://android-developers.blogspot.fr/2011/07/custom-class-loading-in-dalvik.html" rel="nofollow noreferrer">http://android-developers.blogspot.fr/2011/07/custom-class-loading-in-dalvik.html</a> with the DexClassLoader() method.</p>
  
  <p>But i'm unable to see how to display a layout (or any other GUI component) stored as a resource in the plugin .apk file. For instance, i tried without success to create an Intent from the master application by using the plugin classname:</p>
  
  <pre><code>DexClassLoader cl = new DexClassLoader(...);
  Class&lt;?&gt; libClass = cl.loadClass("plugin_classname");
  Intent intent = new Intent(this.getApplicationContext(), libClass);
  startActivity(intent);
  </code></pre>
  
  <p>And this doesn’t work because the Intent is not declared in the AndroidManifest.xml of the master application. This is also described in this other thread: <a href="https://stackoverflow.com/questions/2903260/android-using-dexclassloader-to-load-apk-file">Android- Using DexClassLoader to load apk file</a></p>
  
  <p>Does that mean that there is absolutely no way to build a such "dynamic" user interface?  More generally, can this type of plugin system be done on Android? Should i try an other method?</p>