title: SimpleXML Constructor Exception - Can not create Inner Class
body: <p>I'm just beginning to experiment with Android Development with SimpleXML and thought it was going quite well until I hit a snag.  The code below produces an exception of </p>
  
  <blockquote>
    <p>W/System.err(665): org.simpleframework.xml.core.ConstructorException: Can not construct inner class</p>
  </blockquote>
  
  <p>I've looked through the questions on inner classes and think I understand why you would use them (not that mine was necessarily intentional) but despite moving my code round to try and avoid usage I'm still a little stuck and would appreciate any help.</p>
  
  <p>Source Code:</p>
  
  <pre><code>public class InCaseOfEmergencyMedAlertAllergiesActivity extends Activity {
  public void onCreate(Bundle savedInstanceState){
      super.onCreate(savedInstanceState);
  
  
      Serializer serializer = new Persister();
      InputStream xmlstream = this.getResources().openRawResource(R.raw.sample_data_allergies);
      try {
          medalertdata allergyObject = serializer.read(medalertdata.class, xmlstream);
      } catch (Exception e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
      }
      setContentView(R.layout.allergies);
  }
  
  @Root
  public class medalertdata {
      @ElementList
      private List&lt;allergy&gt; allergyList;
  
      public List getAllergies() {
          return allergyList;
      }
  }
  
  @Root
  public class allergy{
  
      @Element
      private String to;
  
      @Element
      private Boolean medical;
  
      @Element
      private String notes;
  
      public allergy(String to, Boolean medical, String notes){
          this.to = to;
          this.medical = medical;
          this.notes = notes;
      }
  
      public String getTo() {
          return to;
      }
  
      public Boolean getMedical() {
          return medical;
      }
  
      public String getNotes() {
          return notes;
      }
  
  
  }
  </code></pre>
  
  <p>}</p>
  
  <p>With the XML file referenced structured as:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="ISO-8859-1"?&gt;
  &lt;medalertdata&gt;
  &lt;allergy&gt;
      &lt;to&gt;Penicillin&lt;/to&gt;
      &lt;medical&gt;true&lt;/medical&gt;
      &lt;notes&gt;&lt;/notes&gt;
  &lt;/allergy&gt;
  &lt;allergy&gt;
      &lt;to&gt;Bee Stings&lt;/to&gt;
      &lt;medical&gt;false&lt;/medical&gt;
      &lt;notes&gt;Sample&lt;/notes&gt;
  &lt;/allergy&gt;
  &lt;/medalertdata&gt;
  </code></pre>
  
  <p>Is the problem with how I have annotated the SimpleXML classes or where I am trying to read them?  Thanks!  </p>