Java tutorial
//package com.java2s; //License from project: Open Source License import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; public class Main { /** Name of the table */ private static final String TABLE_NAME = "s"; /** * Read data of the last database entry and returns the data as a cursor * * @param db * pointer to database * @return <code>Cursor</code> dayStamp * Cursor with the data of the last row * Entry is * cursor[0] = year stamp * cursor[1] = month stamp * cursor[2] = day stamp * cursor[3] = hour stamp * cursor[4] = minute stamp * cursor[5] = sensor power * cursor[6] = consumed power * cursor[7] = light value */ public static Cursor getLastRow(SQLiteDatabase db) { return db.rawQuery("select * from " + TABLE_NAME + " order by id desc LIMIT 1", null); } }