Java tutorial
//package com.java2s; import android.content.ContentValues; public class Main { public static boolean getAsBoolean(final ContentValues values, final String key, final boolean def) { if (values == null || key == null) return def; final Object value = values.get(key); if (value == null) return def; return Boolean.valueOf(value.toString()); } }