title: Load resource (layout) from another apk dynamically
body: <p>I managed to pull the layouts, and i add it to my viewflipper, however, there it is loaded as blank.</p>
  
  <p>The code is,</p>
  
  <pre><code>Resources packageResources;
  Context packageContext;
  try
  {   
      packageResources = pm.getResourcesForApplication(packageName);
      packageContext = this.createPackageContext(packageName,     Context.CONTEXT_INCLUDE_CODE + Context.CONTEXT_IGNORE_SECURITY);                
   }
   catch(NameNotFoundException excep)
   {
       // the package does not exist. move on to see if another exists.
   }
  
   Class layoutClass;
   try
   {
         // using reflection to get the layout class inside the R class of the package
         layoutClass = packageContext.getClassLoader().loadClass(packageName + ".R$layout");
   }
   catch (ClassNotFoundException excep1)
   {
       // Less chances that class won't be there.
   }
  
   for( Field layoutID : layoutClass.getFields() )
   {
      try
      {
          int id = layoutID.getInt(layoutClass);
          XmlResourceParser xmlResourceLayout = packageResources.getLayout(id);
  
          View v = new View(this, Xml.asAttributeSet(xmlResourceLayout));
  
          this.viewFlipper.addView(v);                 
      }
      catch (Exception excep)
     {
      continue;
     }
  }
  </code></pre>
  
  <p>I get no errors, and i debugged and checked. The layout IDs are correct. However, in my viewFlipper its just blank. No warnings or errors i can find.</p>