ListView Problems

Put your problem here if it does not fit any of the other categories.

ListView Problems

Postby EagerWolf » Wed Mar 16, 2011 10:21 am

Hi!

I am trying to establish ListView from DB query.

The code belove show query:
Code: Select all
public Cursor getAllChannels()  throws SQLException
    {
        return db.query(DATABASE_TABLE, new String[] {
              KEY_ROWID,
              KEY_EPG_NAME,
              KEY_CHANNEL,
              KEY_FAVORITE},
                null,
                null,
                null,
                null,
                null);
    }


And defining the adapter:
Code: Select all
DBAdapter db = new DBAdapter(this);
        db.open();
           Cursor cList = db.getAllChannels();//db.getChannelsList();
           //Cursor cList = getContentResolver().query(People.CONTENT_URI, new String[] {People._ID, People.NAME, People.NUMBER}, null, null, null);
          startManagingCursor(cList);
          
          String[] from = new String[] { DBAdapter.KEY_EPG_NAME, DBAdapter.KEY_CHANNEL };
          int[] to = new int[] { R.id.text1, R.id.text2};
ListAdapter mAdapter = new SimpleCursorAdapter(this, R.layout.channel_list, cList, from, to);


DB Provides regular data (checked with Toast)...

What am I doing wrong?
EagerWolf
Once Poster
Once Poster
 
Posts: 1
Joined: Wed Mar 16, 2011 9:33 am

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 25 guests