我有一个Android应用程序,它使用sqlite数据库存储数据,其中一个字段为 match_date 。
我想要的是三个步骤
第三步我将解决现在我的问题是解决前两个步骤
我将不胜感激任何帮助。
我的通知显示的是2014-06-26数据库中存储的最后一个日期以及我不知道其含义的数字23.
05-21 17:37:55.917: E/inside the Shownotification(1306): index is4
05-21 17:37:55.917: E/inside the Shownotification(1306): date is2014
05-21 17:37:55.921: E/inside the displayNotification(1306): inside displayNotification
05-21 17:37:55.933: E/inside the Shownotification(1306): index is4
05-21 17:37:55.933: E/inside the Shownotification(1306): date is2014
05-21 17:37:55.933: E/inside the displayNotification(1306): inside displayNotification
public Cursor getAllRows(PendingIntent notificationIntent) {
String where = null;
c = database.query(true, TABLE_NAME, ALL_KEYS, where, null, null, null,
null, null);
if (c != null) {
c.moveToFirst();
while (!c.isAfterLast()) {
listdetail = new ItemDetails();
listdetail.setTeam1(c.getString(c.getColumnIndex("team1")));
listdetail.setTeam2(c.getString(c.getColumnIndex("team2")));
listdetail.setDate_match(c.getString(c
.getColumnIndex("match_date")));
// if the pick up date from the database is equal to the current date the notification will pop up
long i = (new Date().getTime()/1000);
//// from the internet
int index = c.getColumnIndex("match_date");
// Toast.makeText(this, c.getColumnIndex("match_date"), Toast.LENGTH_LONG).show();
long date = c.getLong(index);
////////
Log.e("inside the Shownotification", "index is" + index);
//if(time == i){
Log.e("inside the Shownotification", "date is" + date);
NotificationCompat.Builder builder = new Builder(
getApplicationContext());
Notification notification = builder
.setSmallIcon(R.drawable.fifa_2014_4)
.setContentTitle("Up Comming Match")
.setContentText(
c.getString(c.getColumnIndex("match_date"))
+ (c.getColumnIndex("team1"))
+ (c.getColumnIndex("team2"))).build();
displayNotification(notification);
c.moveToNext();
}