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

  • Home
  • SEARCH
  • 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 6790257
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:42:15+00:00 2026-05-26T17:42:15+00:00

New to android development, be gentle haha. I am wanting to populate a spinner

  • 0

New to android development, be gentle haha. I am wanting to populate a spinner with data from my SQLite database. I have a table that is pre-populated and am able to query it successfully. Problem is that I am able to populate the spinner when running it in my emulater (android 2.2) but not able to run it on my portable devices (tablet and phone) (running android 2.2). I get a generic error message saying that: “applilcation…(app name)…has stopped unexpectedly. Please try again.” However, I did notice that in my emulator it works beautifully with the build path being set to “Android 2.2” and yet when I change it to the Google API (2.2 platform), I then encounter it. Am I missing somthing? here is the code being used to populate the spinner control:

 final DBAdapter db = new DBAdapter(this); 
    db.open(); 
    Cursor c = db.getAllStates();

    startManagingCursor(c);             
    String[] columns = new String[]{DBAdapter.KEY_STATE_NAME};
    int[] to = new int []{android.R.id.text1};

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

    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

    //get reference to the spinner...
    Spinner s =(Spinner) findViewById(R.id.spinner_state);
    s.setAdapter(adapter);


    db.close();

Here is my code to get the data:

        public Cursor getAllStates() 
    {    
        Cursor c = null;
                    c = db.query(DATABASE_TABLE_STATE, new String[] { KEY_STATE_ID, KEY_STATE_NAME }, null, null, null, null, null);


        //c = db.rawQuery("select * from tblStates", null);

        return c;   
    }

LocCat:

: INFO/Database(305): sqlite returned: error code = 1, msg = no such table: tblStates
: DEBUG/AndroidRuntime(305): Shutting down VM
: WARN/dalvikvm(305): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
: ERROR/AndroidRuntime(305): FATAL EXCEPTION: main
: ERROR/AndroidRuntime(305): java.lang.RuntimeException: Unable to start activity ComponentInfo{king.chad.SDE/king.chad.SDE.BuildingAddressActivity}
: android.database.sqlite.SQLiteException: no such table: tblStates: , while compiling: SELECT _id, stateName FROM tblStates
: ERROR/AndroidRuntime(305):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
  • 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-26T17:42:15+00:00Added an answer on May 26, 2026 at 5:42 pm

    …after much searching and hair pulling I inserted break points all throughout my code and debugged the hell out of it only to find that the directory (when running on the device vs the emulator) could not be found. Therefore it couldn’t read from the database that I pre-populated which explains why the data wasn’t getting binded to the spinner control. So at the beginning of my activity I checked for the directory and if it didn’t exist I created it. Problem resolved. If anyone else is having same issue as I did feel free to post and I’ll be glad to shed what light I can, thanks to all for your suggestions!

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

Sidebar

Related Questions

I am new to Android Development, i searched many forums for getting Sqlite database
I'm new to Android development. I have an application that allows the user to
I am new to android development and have a confusion that if an activity(
I am new to Android development and have been following the tutorials available on
I'm pretty new to Android development, but I have some experience with Java and
I'm new to Android development and working on an Android application that requires the
I'm new in Android development. I'm looking for any method that applies pitch shifting
I am new to Android development and I have a question regarding custom views
I am new to Android development so have been picking things up over the
New to Android development and have decided to use NetBeans 6.9.1 as my IDE.

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.