title: NullPointerException while using adapter.getItem(position)
body: <p>I have the following code in <strong>WeekDays.java</strong></p>
  
  <pre><code>ArrayAdapter&lt;TaskInAWeek&gt; adapter1 = (ArrayAdapter&lt;TaskInAWeek&gt;) getListAdapter() ;
  TaskInAWeek taski;
  ArrayList&lt;Long&gt; checkedItms = new ArrayList&lt;Long&gt;();
  ArrayList&lt;Long&gt; uncheckedItms = new ArrayList&lt;Long&gt;();
  
      for(int i=0;i&lt;values.size();i++)
      {
          Log.i("value's size:" +values.size()," ");
          if(EditStatusAdapter.tog==1)
          {
              Log.i("i::"+i," ");
                  taski = adapter1.getItem(i);
                  long id = taski.getId();
                  Log.i("nid:"+id," ");
                  checkedItms.add(id);
              }
          else 
          {
              Log.i("i::"+i," ");
              taski = adapter1.getItem(i);
              long id = taski.getId();
              Log.i("nid:"+id," ");
              uncheckedItms.add(id);
          }
      }
  </code></pre>
  
  <p>Its custom Array Adapter is EditStatusAdapter.java. I get a <code>NullPointerException</code> at this pt<code>taski = adapter1.getItem(i);</code>. </p>
  
  <p>I have used similar one in one of my activity but it did work fine. I guess its due to the custom array adapter. But I could not ignore it as well. Can anyone tel me how to clear the exception?</p>