title: What does CursorIndexOutOfBoundsException mean?
body: <p><strong>InfoAPI.java</strong></p>
  <p>When I click Save button, it crashed. How can I fix this?</p>
  <pre><code>public long insertTimeSheet(String name,String weather,String date,String status)
      {
          database=dbHelper.getWritableDatabase();
          ContentValues values=new ContentValues();
          values.put(MyDatabaseHelper.Name,name);
          values.put(MyDatabaseHelper.Weather,weather);
          values.put(MyDatabaseHelper.Date,date);
          values.put(MyDatabaseHelper.Status, status);
          Cursor cursor = database.rawQuery(&quot;SELECT MAX(ID) FROM &quot;+ MyDatabaseHelper.TABLE_INFO, null);
          database.insert(MyDatabaseHelper.TABLE_INFO, null, values);
          return cursor.getLong(0);
  
      }
  </code></pre>
  <p><strong>LogCat</strong></p>
  <pre><code>android.database.CursorIndexOutOfBoundsException: Index -1 requested, with a size of 1
              at android.database.AbstractCursor.checkPosition(AbstractCursor.java:460)
              at android.database.AbstractWindowedCursor.checkPosition(AbstractWindowedCursor.java:136)
              at android.database.AbstractWindowedCursor.getLong(AbstractWindowedCursor.java:74)
              at com.example.project.project.API.InfoAPI.insertTimeSheet(InfoAPI.java:42)
  </code></pre>
  <p>I have posted a question regarding to <code>Foreign Key</code>.</p>
  <p><a href="https://stackoverflow.com/questions/32986635/getting-null-value-in-foreign-key-column">Getting NULL value in foreign key column</a></p>