I have formatted the timepicker and Datepicker data into the following formats hh:mm AM/PM and dd/MM/yyyy, and stored both the variables into sqlite database.
Now, in another activity I need to retrieve these values from the database, and pass a pendingintent alarm through alarmmanager.
My problem is that I am getting these values in the activity from database, but I can't figure out how to compare these values to current calendar time, and pass the pendingIntent like cal.getTimeInMillis().
I tried using SimpleDateFormat, but it catches ParseException: Unparseable Date
Can someone help me out with this problem? Thanks in advance
I have tried SimpleDateFormat like this
SimpleDateFormat sdf = new SimpleDateFormat(" MM/dd/yyyy h:mm a", Locale.US);
try {
cal.setTime(sdf.parse(dnt));
} catch(ParseException e){
Log.d(LOGCAT, e.toString());
}
Aucun commentaire:
Enregistrer un commentaire