title: Android query cursor
body: <p>i have a problem with a cursor. i created a alarm manager that pick a value  to compare with another in looping.</p>
  
  <p>My problem is this: if the cursor is outside of the loop this pick only my <code>first</code> value (if exsist only one value pick only this obviously).... if the cursor is in the loop, this pick only <code>last</code> value (if exsist only one value pick only this obviously).</p>
  
  <p>how to fix this?</p>
  
  <p>my query:</p>
  
  <pre><code>public Cursor getRegistry2()
      {
          return (getReadableDatabase().query(
              TabRegistry.TABLE_NAME, 
              TabRegistry.COLUMNS, 
              TabRegistry._ID, 
              null,
              null, 
              null, 
              null));
  </code></pre>
  
  <p>my cursor in service:</p>
  
  <pre><code> Cursor c5 = databaseHelper.getRegistry2();
                       c5.moveToFirst();
                          while(c5.isAfterLast() == false){   
                              tipe = c5.getString(c5.getColumnIndex(TabRegistry.TYPE)); 
  
                              status = c5.getString(c5.getColumnIndex(TabRegistry.STATUS)); 
                              number = c5.getString(c5.getColumnIndex(TabRegistry.NUMBER)); 
                          c5.moveToNext();
                          }
                         c5.close(); 
  </code></pre>
  
  <p>thanks in advance!</p>