I have created a database with a cursor. I want to show it in a list view. This is my Activity file:
package com.ucas.course; import java.util.List; import org.w3c.dom.Comment; import android.app.Activity; import android.app.ListActivity; import android.os.Bundle; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.SimpleCursorAdapter; import android.widget.TextView; public class SQLView extends ListActivity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.list_example); UCAS info = new UCAS(this); info.open(); String values = info.getData(); info.close(); AString[] columns = new String[] {UCAS.KEY_UNIVERSITY}; int[] to = new int[] { R.id.name_entry, R.id.number_entry }; startManagingCursor(c); SimpleCursorAdapter mAdapter = new SimpleCursorAdapter(this, R.layout.sqlview, c, columns, to); this.setListAdapter(mAdapter); } } AT the moment there are no error apart from one cursor error "invalid statement in fillWindow()", I don't know if that has something to do with my issue but when I start the activity I just get a blank screen
public Cursor getData() { // TODO Auto-generated method stub String[] columns = new String[]{KEY_ROWID, KEY_UNIVERSITY, KEY_OFFER}; Cursor c = ourDatabase.query(DATABASE_TABLE, columns, null, null, null, null, null); return c; }