G
G
gochag2017-06-14 11:34:55
Java
gochag, 2017-06-14 11:34:55

How to find the length of a SQLite android table?

I want to implement a start window where I will set a password if there are no rows in the table. Otherwise, launch another activity. How to get the length of a table or check if a row exists in a table.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2017-06-14
@gochag

long rowCount  = DatabaseUtils.queryNumEntries(db, TABLE_NAME);

or
long rowCount = DatabaseUtils.longForQuery(db, "SELECT COUNT(*) FROM table_name", null);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question