Saurabh Verma
Saurabh Verma

Reputation: 6718

How to get all the columns in Android?

Can anyone please tell me how can I get all the column names used in a database table in Android?

Upvotes: 1

Views: 158

Answers (2)

ud_an
ud_an

Reputation: 4921

  • c.getColumnName(0)

access cursor property 0,1,2 pass as many column u have

Upvotes: 2

ba__friend
ba__friend

Reputation: 5903

Two possible ways i can think of:

PRAGMA table_info(yourTable)

or

SELECT * FROM yourTable LIMIT 0

To get all tables:

SELECT * FROM sqlite_master WHERE type = 'table'

Upvotes: 0

Related Questions