How to go through every record in sqllite db?

Posted by Pavel on Stack Overflow See other posts from Stack Overflow or by Pavel
Published on 2010-06-08T07:44:00Z Indexed on 2010/06/08 7:52 UTC
Read the original article Hit count: 169

Filed under:
|

Hi guys. I think it's kinda easy one but still I'm new to android programming so please have patience. I want to know how can I get the number of records (rows) in a specific table in my db. I need this so I can create a loop to go through every record and add each one of it to the specific Array and display it later on. This is the source:

db.openDataBase();            // open connection with db

Cursor c = db.getTitle(5);    // loop here through db, right now I'm fetching only one record

startManagingCursor(c);

//adding areas to the list here

Area o1 = new Area();

o1.setOrderName(c.getString(1) + c.getString(2));  

m_areas.add(o1);

db.close();

Does anyone can help me with this please? Thx in advance!

© Stack Overflow or respective owner

Related posts about android

Related posts about sqlite