try
{
DaoSession session=MyApplication.getInstances().getDaoSession();
long fromId=-1;
String strSql="select * from test order by ID desc limit 0,1 ";
Cursor c = session.getDatabase().rawQuery(strSql,null);
if(c.moveToFirst())
{
fromId=c.getLong(c.getColumnIndex("ID")); }
c.close();
}
catch (Exception ex)
{
showToast(ex.getMessage());
}