title: Can't add element to ArrayList in for loop
body: <p>I am currently having the problem of not able to run the following code in Android app development.</p>
  
  <pre><code>import java.util.ArrayList;
  
  public class Test extends FragmentActivity {
  
  ArrayList&lt;String&gt; random;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      // TODO Auto-generated method stub
      super.onCreate(savedInstanceState);
          for (int a=0; a&lt;11; a++){
          random.add("a");
      }
              }
      }
  </code></pre>
  
  <p>I know the above code does useless action but that is simplified from my problem in the for loop code in JAVA. And I got this error from the error log, "unhandled event loop exception". Can anyone point out that what I am doing wrong please?</p>