public static void dumpCurrentRow ( Cursor cursor , StringBuilder sb ) { String [ ] cols = cursor . getColumnNames ( ) ; sb . append ( "" + cursor . getPosition ( ) + " {\n" ) ; int length = cols . length ; for ( int i = 0 ; i < length ; i ++ ) { String value ; try { value = cursor . getString ( i ) ; } catch ( SQLiteException e ) { // assume that if the getString threw this exception then the column is not // representable by a string, e.g. it is a BLOB. value = "<unprintable>" ; } sb . append ( " " + cols [ i ] + ' ' + value + "\n" ) ; } sb . append ( "}\n" ) ; }
Prints the contents of a Cursor s current row to a StringBuilder .