android - Database Query only returns column name -
hello , help! database has 4 columns , need way return newest item added last column each time. column name spininterval , value int.
database http://www.bthindiet.com/datatable.jpg
in dbadapter class have set method retrieving data
public cursor fetchreminder(long rowid) throws sqlexception { cursor mcursor = mdb.query(true, database_table, new string[] {key_rowid, key_title, key_body, key_date_time, key_spinner}, key_rowid + "=" + rowid, null, null, null, null, null); if (mcursor != null) { mcursor.movetofirst(); } return mcursor; }
the code tried
string repeat = remindersdbadapter.key_spinner.tostring();
returned name of column spininterval. correct way query info (60 * 60 * 1000 * 8) , work each time new item added db? going add info alarmmanager setrepeating call.
public class remindermanager { private context mcontext; private alarmmanager malarmmanager; string repeat = remindersdbadapter.key_spinner.tostring(); private static final string tag = "myactivity"; public remindermanager(context context) { mcontext = context; malarmmanager = (alarmmanager)context.getsystemservice(context.alarm_service); } public void setreminder(long taskid, calendar when) { log.e(tag, repeat); intent = new intent(mcontext, onalarmreceiver.class); i.putextra(remindersdbadapter.key_rowid, (long)taskid); pendingintent pi = pendingintent.getbroadcast(mcontext, 0, i, pendingintent.flag_one_shot); malarmmanager.setrepeating(alarmmanager.rtc_wakeup, when.gettimeinmillis(), repeat, pi); }
}
can me correct code this? stuck on it.
string selectquery = "select * from" + database_table +"order key_rowid desc limit 1"; sqlitedatabase db = this.getwritabledatabase(); cursor cursor = db.rawquery(selectquery, null);
Comments
Post a Comment