title: Cursor for calls index out of bound
body: <p>I am trying to parse all the log of calls, but when ONLY the first call ends, the cursor is out of bound. It throws 2 exceptions (for date and duration)</p>
  
  <p>Thank you in advance</p>
  
  <p>My code is here:</p>
  
  <pre><code>if (c != null &amp;&amp; c.getCount()&gt;0) {
          if (c.moveToFirst()) {!
              type = Integer.parseInt(c.getString(c.getColumnIndex(CallLog.Calls.TYPE)));
              do {
                  try{
                      Log.d(this.getClass().getName(),"Date is "+c.getString(c.getColumnIndex(Calls.DATE)));
                  }catch(Exception e){
                      Log.d(this.getClass().getName(),"Exception: DATE IS NULL!!");
                  }
              //String timestamp = c.getString(c.getColumnIndex(Calls.DATE));
                  //Log.d(this.getClass().getName(),"timestamp is: "+timestamp);
                  try{
                      long duration= c.getLong(c.getColumnIndex(CallLog.Calls.DURATION));
                  }catch(Exception e){
                      Log.d(this.getClass().getName(),"Exception:  DURATION IS NULL!!");
                  }
                  //callDuration.put(timestamp, duration);
              }
              while (!c.moveToNext());
          }
      }
  </code></pre>