convert Cursor To Content Values - Android Database

Android examples for Database:Cursor Convert

Description

convert Cursor To Content Values

Demo Code


//package com.java2s;
import android.content.ContentValues;
import android.database.Cursor;
import java.util.List;

public class Main {
    public static void convertToContentValues(Cursor cursor,
            List<ContentValues> list) {
        if (isEmpty(cursor)) {
            return;
        }//from  www.ja v  a 2 s .c o m
        cursor.moveToFirst();
        do {
            ContentValues contentValues = new ContentValues();
            //converter.convert(cursor, contentValues);
            list.add(contentValues);
        } while (cursor.moveToNext());
    }

    public static boolean isEmpty(Cursor cursor) {
        return cursor == null || cursor.getCount() == 0;
    }
}

Related Tutorials