title: Android Form as an Activity
body: <p>I have an application with multiple activities. In the main class I open a database and create a list of the content like so:</p>
  
  <pre><code>public class MyApplication extends Activity
  {
      private List&lt;PhoneNumber&gt; numberList;
  
      public void onCreate(Bundle savedInstanceState)
      {
          ...
          numberList = new ArrayList&lt;PhoneNumber&gt;();
          ...
          loadDatabase()
          ...
      }
  
      private void loadDatabase()
      {
          // File IO and parsing stuff
          addNumber(thisNumber);   // executes for each entry
      }
  
      public void addNumber(PhoneNumber thisNumber)
      {
          numberList.add(thisNumber);
      }
  }
  </code></pre>
  
  <p>This works fine and I have a ListView in the main activity that is populated with this data. Now, moving on to the next step. I am trying to launch a form as a new activity that will add an entry to this list. The activity launches fine, and I was able to build a form easily. The problem is accessing the list to add to it.</p>
  
  <pre><code>public class AddNumber extends Activity
  {
      ...
      // This function is called from the done button
      // &lt;Button android:text="Done" android:onClick="formDone"/&gt;
      public void formDone(View v)
      {
          // findViewByIds here to get data from form. 
          // This is done correctly and I can see my data in memory
  
          MyApplication access = new MyApplication();
          PhoneNumber newNumber = new PhoneNumber();
  
          // Fill newNumber object with data from form. Done correctly. Verified
  
          access.addNumber(newNumber);
      }
  </code></pre>
  
  <p>The last line of <code>formDone()</code> executes correctly. Through debugging I can step through to the Application class and it executes <code>addNumber()</code>. Before executing <code>numberList.add(thisNumber);</code> I can look at the contents of memory for the <code>thisNumber</code> object it is trying to add to the list and that data is correct. Attempting to execute that line though crashes the application in standard Android format. (Loads View.class with 'Source not found' followed by ZygoteInit$MethodBlahBlah).</p>
  
  <p>So I'm a little confused because it looks like the data being fed to <code>addNumber()</code> is correct, and the function works perfectly fine when the application first launches by building the list from the data in the database. Fundamentally, am I thinking about this correct? Should a form like this be it's own activity or is there a better way to do it? If it can be it's own activity, what am I doing wrong?</p>
  
  <p>Thanks,<br>
  Nate</p>