Getting Index -1 requested, with a size of 1 error while fetching data android : <p>I am using following code to get version of content </p>

<pre><code>public String getNotificationVersion(String rootContentId) {
    String strVersion = "";
    try {
        database.open();
        Cursor cur = database.query(Database.DOWNLOAD_TABLE,
                new String[] { Database.KEY_VERSION },
                Database.KEY_ROOT_CONTENT_ID + " = ?",
                new String[] { rootContentId }, null, null, null);
        Log.v("NOTIFICATION PRESENT IN DOWNLOAD GETTING DOWNLOAD", "TRUE");
        strVersion = cur.getString(0);
        cur.close();
        database.close();

    } catch (Exception e) {
        Log.v("NOTIFICATION PRESENT IN DOWNLOAD GETTING DOWNLOAD", e.getMessage());
        // TODO: handle exception
    }
    return strVersion;
}
</code></pre>

<p>and at "strVersion = cur.getString(0);" line I am getting Index -1 requested, with a size of 1 error.
I have checked database and there is value for this column. Where I am doing wrong?</p>

<p>Thanks in Advance</p>
