java.lang.RuntimeException

If you like a tip written by other Samebug users, mark is as helpful! Marks help our algorithm provide you better solutions and also help other users.
tip

You have an empty cursor. Check your query if it is not expected, or handle empty cursor with `if(cursor.getCount() > 0) ...`

tip

When you get a Cursor returned from the database you should do an moveToFirst(); before trying to get data from it.

tip

You need to make sure that there is a data in the cursor. Check that moveToFirst() return true.

You have a different solution? A short tip here would help you and many other users who saw this issue last week.

  • GitHub comment 4#58334446
    via GitHub by janlem
    ,
  • Strange error at super.onStart();
    via Stack Overflow by José Mª
    ,
  • Delete Database and ListView in Android
    via by Unknown author,
  • Buchuaco Beach House - Google+
    via by Unknown author,
  • Runtime Cursor error in android | Tech Jaffa
    via by Unknown author,
    • java.lang.RuntimeException: Error receiving broadcast Intent { act=android.intent.action.DOWNLOAD_COMPLETE flg=0x10 pkg=com.downman.test (has extras) } in org.apache.cordova.backgroundDownload.BackgroundDownload$1@b119fd70 at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:778) at android.os.Handler.handleCallback(Handler.java:733) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5017) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) at dalvik.system.NativeStart.main(Native Method) Caused by: android.database.CursorIndexOutOfBoundsException: Index 0 requested, with a size of 0 at android.database.AbstractCursor.checkPosition(AbstractCursor.java:426) at android.database.AbstractWindowedCursor.checkPosition(AbstractWindowedCursor.java:136) at android.database.AbstractWindowedCursor.getString(AbstractWindowedCursor.java:50) at android.database.CursorWrapper.getString(CursorWrapper.java:114) at android.database.CursorWrapper.getString(CursorWrapper.java:114) at android.app.DownloadManager$CursorTranslator.getString(DownloadManager.java:1318) at org.apache.cordova.backgroundDownload.BackgroundDownload$1.onReceive(BackgroundDownload.java:358) at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:768)

    Users with the same issue

    filpgame
    9 times, last one,
    Unknown visitor2 times, last one,
    Indri Yunita
    1 times, last one,
    rafael
    1 times, last one,
    Unknown visitor1 times, last one,
    51 more bugmates