title: Add object in List ( Android )
body: <p>i'm trying to put some intents in a List to a specific place but the app crashes 'cause of NullPointerExecption but don't understand why !</p>
  
  <pre><code>private ArrayList&lt;PendingIntent&gt; test;
  
  [...]
  
  try
  {
       test.add( 42, alarm_Intent);
  // I tried aswell without index ( it makes it crash too ) :
       test.add(alarm_Intent);
  }
  catch (Exception e)
  {
       Toast.makeText(this, ""+e.toString(), Toast.LENGTH_LONG).show();
  }
  </code></pre>
  
  <p>Here is the error :</p>
  
  <pre><code>[2014-06-08 18:30:41 - ddms] null
  java.lang.NullPointerException
  at com.android.ddmlib.Client.read(Client.java:698)
  at com.android.ddmlib.MonitorThread.processClientActivity(MonitorThread.java:311)
  at com.android.ddmlib.MonitorThread.run(MonitorThread.java:263)
  </code></pre>
  
  <p>What did i do wrong ?</p>