wrap ContentValues - Android android.content

Android examples for android.content:ContentValues

Description

wrap ContentValues

Demo Code


//package com.java2s;
import android.content.ContentValues;

public class Main {

    public static ContentValues wrapContentValues(String[] columns,
            String[] values) {//from w w  w  .  ja v a  2s .c  o  m
        if (columns == null || values == null
                || (columns.length != values.length)) {
            throw new IllegalArgumentException(
                    "Cannot wrap content values due to wrong parameters!");
        }
        ContentValues cv = new ContentValues();
        for (int i = 0; i < values.length; i++) {
            cv.put(columns[i], values[i]);
        }
        return cv;
    }
}

Related Tutorials