Apps SimpleCursorAdapter from SQLite

ondrovic

Newbie
I am trying to open a pre-created SQLite database that is stored on the sd card and populate the data from the database to a spinner. I am having issues getting the information to populate in the spinner and was wondering if anyone could lend a hand so to speak. I have a database that has 15 tables in it. Right now I am just trying to populate data from the table att_individual_talk and display it in the first spinner.

Here is my code:
Code:
package com.ondrovic.bbym;

import android.app.Activity;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.widget.SimpleCursorAdapter;
import android.widget.Spinner;

public class Individual_ATT extends Activity{
	SQLiteDatabase db = null;
	
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		setContentView(R.layout.individual_att);
		
		db = SQLiteDatabase.openDatabase(Dashboard.rDIR + Dashboard.fDIR + Dashboard.fNAME, null, SQLiteDatabase.OPEN_READONLY);
		
		getTalk();
		
	}
	
	public void getTalk() {
		Cursor talkCursor = db.rawQuery("SELECT * FROM att_individual_talk ORDER BY _id", null);
		Spinner talk = (Spinner) findViewById(R.id.spinner_talk);
		SimpleCursorAdapter talkAdapter = new SimpleCursorAdapter(this, android.R.layout.simple_spinner_item, talkCursor, new String[] {"_id"}, null);
		talkAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
		talk.setAdapter(talkAdapter);
		
	}
}

Any suggestions or insight as to what I am doing wrong?

Thanks
 
Top