Cursor Exception
<p>I have created a database and i want to retrieve some data from the database by using the cursor by i always get this error</p>

<pre><code>04-19 20:02:56.747: E/AndroidRuntime(301): android.database.CursorIndexOutOfBoundsException: Index -1 requested, with a size of 1
04-19 20:02:56.747: E/AndroidRuntime(301):  at android.database.AbstractCursor.checkPosition(AbstractCursor.java:580)
04-19 20:02:56.747: E/AndroidRuntime(301):  at android.database.AbstractWindowedCursor.checkPosition(AbstractWindowedCursor.java:214)
04-19 20:02:56.747: E/AndroidRuntime(301):  at android.database.AbstractWindowedCursor.getString(AbstractWindowedCursor.java:41)
</code></pre>

<p>here is the code of the function</p>

<pre><code>public double getlatitude(String[] i,int x) {
        // TODO Auto-generated method stub
        String[] columns = new String[] { KEY_SQUAREID, KEY_SQUARELATITUDE, KEY_SQUARENAME,
                KEY_SQUARELONGITUDE
                 };

    Cursor c;
      c=ourDatabase.query("squares", columns,"squarename=?",i, null, null, null);

      String latitude = null;
        if (c.moveToFirst()) {
             latitude=c.getString(0);
        }

        double latitude_double=Double.parseDouble(latitude);
        return latitude_double;
    }
</code></pre>
