Log database Cursor Info - Android Database

Android examples for Database:Cursor

Description

Log database Cursor Info

Demo Code


//package com.book2s;
import android.database.Cursor;
import android.util.Log;

public class Main {

    public static void LogCursorInfo(Cursor c, String debugTag) {

        String rowHeaders = "|| ";
        for (int i = 0; i < c.getColumnCount(); i++) {

            rowHeaders = rowHeaders.concat(c.getColumnName(i) + " || ");
        }/*from   ww  w.j  av  a  2 s. c o  m*/

        c.moveToFirst();
        while (c.isAfterLast() == false) {
            String rowResults = "|| ";
            for (int i = 0; i < c.getColumnCount(); i++) {
                rowResults = rowResults.concat(c.getString(i) + " || ");
            }

            c.moveToNext();
        }
    }
}

Related Tutorials