Select first row from table in SQLiteDatabase - Android Database

Android examples for Database:Table Row Query

Description

Select first row from table in SQLiteDatabase

Demo Code


//package com.java2s;

import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;

public class Main {
    public static Cursor first(SQLiteDatabase db, String name) {
        return db.rawQuery("SELECT id, data FROM " + name + " LIMIT 1;",
                null);//from   ww w.  j  a  va 2s  .com
    }
}

Related Tutorials