Convert cursor To String Array - Android Database

Android examples for Database:Cursor Convert

Description

Convert cursor To String Array

Demo Code


//package com.java2s;
import android.database.Cursor;
import java.util.ArrayList;

public class Main {
    public static void cursorToStringArray(Cursor c,
            ArrayList<String> arrayList, String columnName) {
        int columnIndex = c.getColumnIndex(columnName);
        for (c.moveToFirst(); !c.isAfterLast(); c.moveToNext()) {
            arrayList.add(c.getString(columnIndex));
        }//from   ww w .j a v a2  s. c o  m

    }
}

Related Tutorials