Note that there are some explanatory texts on larger screens.

plurals
  1. POIssue when running in a android google API (2.2 platform)
    primarykey
    data
    text
    <p>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:</p> <pre><code> 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(); </code></pre> <p>Here is my code to get the data:</p> <pre><code> 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; } </code></pre> <p>LocCat:</p> <pre><code>: 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) </code></pre>
    singulars
    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.
 

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