Note that there are some explanatory texts on larger screens.

plurals
  1. POCursorIndexOutOfBounds error when changing views
    primarykey
    data
    text
    <pre><code>07-05 23:23:27.497: ERROR/AndroidRuntime(390): java.lang.RuntimeException: Unable to resume activity {com.fttech.books/com.fttech.books.creatBook}: android.database.CursorIndexOutOfBoundsException: Index 0 requested, with a size of 0 07-05 23:23:27.497: ERROR/AndroidRuntime(390): Caused by: android.database.CursorIndexOutOfBoundsException: Index 0 requested, with a size of 0 </code></pre> <p>I keep getting these errors when i run i change views and it calls my onResume method to re-populate EditText fields. Here is my code for on resume:</p> <pre><code>protected void onResume(){ Log.v(tag, "In onResume!"); Cursor it = mDbHelper.fetchBook(mRowId); super.onResume(); mDbHelper.open(); setRowIdFromIntent(); if (it.moveToFirst()) { populateFields(); } </code></pre> <p>Here is my setRowIdFromIntent method:</p> <pre><code>private void setRowIdFromIntent(){ if(mRowId == null){ Bundle extras = getIntent().getExtras(); mRowId = extras != null ? extras.getLong(DbAdapter.KEY_ROWID) :null; } </code></pre> <p>PopulateFields method which retrieves information from the database if the activity is paused and then resumed, such as when i change from porttrait to landscape.</p> <pre><code>private void populateFields() { if(mRowId != null){ Cursor books = mDbHelper.fetchBook(mRowId); startManagingCursor(books); bookTitle.setText(books.getString(books.getColumnIndexOrThrow(DbAdapter.KEY_BOOK))); bookAuthor.setText(books.getString(books.getColumnIndexOrThrow(DbAdapter.KEY_AUTHOR))); bookIsbn.setText(books.getString(books.getColumnIndexOrThrow(DbAdapter.KEY_ISBN))); ratingBar.setRating(books.getFloat(books.getColumnIndex(DbAdapter.KEY_RATING))); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload