Assumes that the cursor being passed in was generated with a select count() query with a unique int result being returned - Android Database

Android examples for Database:Cursor

Description

Assumes that the cursor being passed in was generated with a select count() query with a unique int result being returned

Demo Code


//package com.book2s;

import android.database.Cursor;

public class Main {
    /**//from  w w  w  . j a  va  2  s  . c o m
     * Assumes that the cursor being passed in was
     * generated with a select count() query with a unique
     * int result being returned
     * @param result
     * @return
     */
    public static Integer getCount(Cursor result) {
        if (result.moveToFirst()) {
            return result.getInt(0);
        }
        return null;
    }
}

Related Tutorials