Note that there are some explanatory texts on larger screens.

plurals
  1. PODynamic spinner using a SQLite Database
    primarykey
    data
    text
    <p>I want my spinner to be dynamically updated from my SQLite database. The spinner should contain months and years (ex. april 2013), from my sqlite database. I have searched the web a lot, and also many of the questions from this site, but now i can't solve the rest. Right now my spinner list is getting longer, but there is no text? What is the problem?</p> <p>Here is the relevant code in my main class</p> <pre><code>KilometerSQL info = new KilometerSQL(this); info.open(); String data = info.getData(); final Cursor cSpinner; cSpinner = (Cursor) KilometerSQL.getSpinnerData(); startManagingCursor(cSpinner); SimpleCursorAdapter scaYear = new SimpleCursorAdapter(this, android.R.layout.simple_spinner_item,cSpinner,new String[] {KilometerSQL.KEY_MONTH},new int[]{}); scaYear.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner1.setAdapter(scaYear); info.close(); tvView.setText(data); </code></pre> <p>And here is my SQLiteDatabase:</p> <pre><code>public static Cursor getSpinnerData() { // TODO Auto-generated method stub return ourDatabase.query(DATABASE_TABLE, //table name new String[] {KEY_ROWID, KEY_MONTH}, //list of columns to return null, //filter declaring which rows to return; formatted as SQL WHERE clause null, KEY_MONTH, //filter declaring how to group rows; formatted as SQL GROUP BY clause null, //filter declaring which row groups to include in cursor; formatted as SQL HAVING clause null); //how to order rows; formatted as SQL ORDER BY clause } </code></pre> <p>Don't hesitate to ask questions if you need some info or code.</p> <p>Thank you very much.</p>
    singulars
    1. This table or related slice is empty.
    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.
    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