long From Cursor - Android android.database

Android examples for android.database:Cursor

Description

long From Cursor

Demo Code

import android.database.Cursor;

public class Main{

     static long longFromCursor(Cursor c) {
        long id = -1;
        if (c != null) {
            c.moveToFirst();//from w w w .j  a va 2s .  c  o m
            if (!c.isAfterLast()) {
                id = c.getLong(0);
            }
        }
        c.close();
        return id;
    }

}

Related Tutorials