Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7729335
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T05:56:33+00:00 2026-06-01T05:56:33+00:00

I have trouble with my app, when i’m trying to get active user from

  • 0

I have trouble with my app, when i’m trying to get active user from the database. Here is my code from the function.

public String getActiveChild(){
    Cursor cur = database.query(true, TABLE_CHILDREN, null, "status = 1", null, null,
            null, null, null);
    Log.v("test4e",cur.getCount()+" count");
    cur.moveToFirst();
    Log.v("test", cur.getString(cur.getColumnIndex("name")));
    return cur.getString(cur.getColumnIndex("name"));
}

This works perfectly on the emulator but when i test it on a device it gives me this error in logcat.

 04-03 11:51:02.362: E/AndroidRuntime(961): FATAL EXCEPTION: main
04-03 11:51:02.362: E/AndroidRuntime(961): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.app.myapp/com.app.myapp.SettingsActivity}: android.database.CursorIndexOutOfBoundsException: Index 0 requested, with a size of 0
04-03 11:51:02.362: E/AndroidRuntime(961):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1768)
04-03 11:51:02.362: E/AndroidRuntime(961):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1784)
04-03 11:51:02.362: E/AndroidRuntime(961):  at android.app.ActivityThread.access$1500(ActivityThread.java:123)
04-03 11:51:02.362: E/AndroidRuntime(961):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:939)
04-03 11:51:02.362: E/AndroidRuntime(961):  at android.os.Handler.dispatchMessage(Handler.java:99)
04-03 11:51:02.362: E/AndroidRuntime(961):  at android.os.Looper.loop(Looper.java:130)
04-03 11:51:02.362: E/AndroidRuntime(961):  at android.app.ActivityThread.main(ActivityThread.java:3835)
04-03 11:51:02.362: E/AndroidRuntime(961):  at java.lang.reflect.Method.invokeNative(Native Method)
04-03 11:51:02.362: E/AndroidRuntime(961):  at java.lang.reflect.Method.invoke(Method.java:507)
04-03 11:51:02.362: E/AndroidRuntime(961):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:847)
04-03 11:51:02.362: E/AndroidRuntime(961):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:605)
04-03 11:51:02.362: E/AndroidRuntime(961):  at dalvik.system.NativeStart.main(Native Method)
04-03 11:51:02.362: E/AndroidRuntime(961): Caused by: android.database.CursorIndexOutOfBoundsException: Index 0 requested, with a size of 0
04-03 11:51:02.362: E/AndroidRuntime(961):  at android.database.AbstractCursor.checkPosition(AbstractCursor.java:580)
04-03 11:51:02.362: E/AndroidRuntime(961):  at android.database.AbstractWindowedCursor.checkPosition(AbstractWindowedCursor.java:214)
04-03 11:51:02.362: E/AndroidRuntime(961):  at android.database.AbstractWindowedCursor.getString(AbstractWindowedCursor.java:41)
04-03 11:51:02.362: E/AndroidRuntime(961):  at com.app.myyapp.DatabaseHelper.getActiveChild(DatabaseHelper.java:168)
04-03 11:51:02.362: E/AndroidRuntime(961):  at com.app.myyapp.SettingsActivity.init(SettingsActivity.java:61)
04-03 11:51:02.362: E/AndroidRuntime(961):  at com.app.myyapp.SettingsActivity.onCreate(SettingsActivity.java:50)
04-03 11:51:02.362: E/AndroidRuntime(961):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
04-03 11:51:02.362: E/AndroidRuntime(961):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1722)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T05:56:34+00:00Added an answer on June 1, 2026 at 5:56 am

    There is no matching data. You should check the return value of cur.moveToFirst() before trying to read from it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have trouble to user uniqness couples in my app... I have users witch
i recently switched from cs5.5 to FlashDevelop and i have trouble publishing my app
I have trouble getting it to copy file from src to destination. var asMsg_path:String
I have trouble to get gluLookAt working. I have the following code which works
I am developing a small windows app, but have some trouble deciding whether to
I have a rails app that has asynchronous processing, and I'm having trouble getting
I have trouble with the following piece of code. When I go through with
I have trouble using Perl grep() with a string that may contain chars that
I have trouble defining a trigger for a MySQL database. I want to change
I have trouble when designing classes like this class C1 { public: void foo();

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.