get Cursor Column String - Android Database

Android examples for Database:Cursor Column

Description

get Cursor Column String

Demo Code


//package com.java2s;

import android.database.Cursor;

public class Main {

    public static String getCursorColumnString(Cursor cursor) {
        String[] columns = cursor.getColumnNames();
        StringBuilder builder = new StringBuilder("[");
        for (int i = 0; i < columns.length - 1; i++) {
            builder.append(columns[i] + ",");
        }/*from   w  ww.j av  a 2  s.  c  o m*/
        builder.append(columns[columns.length - 1]).append("]");
        return builder.toString();
    }
}

Related Tutorials