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 7001791
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:50:51+00:00 2026-05-27T20:50:51+00:00

Alright so i have been working on this Dynamic load of a spinner from

  • 0

Alright so i have been working on this “Dynamic load of a spinner” from this forum anddev.org i fixed the force closing error i have been getting now the issue i have been having when i start to use my sql variables, starting on the emulator it to me is locking up and seems like the cursor is stuck in a loop, logcat doesn’t show any errors. any ideas on where it might be sticking and or messed up?

public static final String KEY_ROWID = "_rowid";
    public static final String KEY_ONE = "serial";
    public static final String KEY_TWO = "name";
    public static final String KEY_THREE = "place";

    private static final String KEY_DB = "DbTester";
    private static final String KEY_TABLE = "DbTable";
    private static final int VERSION = 1;

    //static final String DB_NAME="contacts";
    //static final String NAMES_TABLE="names";
    private DbHelper ourHelper;
    private final Context ourContext;
    private SQLiteDatabase ourDB;
    SQLiteDatabase db=null;

then here is my method loadSpinner()

DbHelper dbhelper=new DbHelper(this.ourContext, KEY_TABLE, null, 2);
            db=dbhelper.getWritableDatabase();

            Cursor c=db.rawQuery("SELECT * FROM "+KEY_TWO, null);

            if(c != null) {

            while(!c.isLast())
                    c.moveToNext(); //I dont understand why but it's necessary (alternative call c.getCount() )

            String[] from=new String[1];
            from[0]="name";

            int[] to=new int[1];
            to[0]=android.R.id.text1;


            SimpleCursorAdapter adapter=new SimpleCursorAdapter(this.ourContext, android.R.layout.simple_spinner_item, c, from, to);


           c.close();
            db.close();

            return adapter;
            }

can’t think of anything else that might help out, if anymore info is need just say so and i’ll post it. Thanks in advance

  • 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-05-27T20:50:52+00:00Added an answer on May 27, 2026 at 8:50 pm

    Three pieces of evidence I see:

    1) Your emulator is locking up.
    2) In my experience, while statements are notorious for causing lockups.
    3) You don’t know what your while statement does, but you need it.

    Testing recommendation:

    Try replacing the while with if statement and make only one call to c.MoveToNext() and see if you still get the lockup. If so, you’ve narrowed the issue.

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

Sidebar

Related Questions

Alright, some of you might have noticed I've been working on this problem off
Alright have been working to switch to jQuery 1.7's new and improved .on() function
Alright, I know questions like this have probably been asked dozens of times, but
Alright, so I have been wondering how to do this for a while. Basically,
Alright. This may be difficult but I have been struggling for quite a bit
Alright, I have been breaking my head over this one for more than a
Alright, I've been working on this for a while and cannot get it. I'm
Alright I have been trying to figure this out and I read the MSDN
Alright I've been working on this for hours now and can't figure out my
Alright, I have been messing with this for a few hours now, and I

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.