Pentium10 Pentium10 - 1 year ago 91
Android Question

How to get a tables columns arraylist on Android?

I am after a code to get the available column names of a table in Android?

I looked around and didn't find anything.

Answer Source

This is a simpler way:

Cursor ti = db.rawQuery("PRAGMA table_info(mytable)", null);
if ( ti.moveToFirst() ) {
    do {
        System.out.println("col: " + ti.getString(1));
    } while (ti.moveToNext());
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download