I am new to android. I am storing time in a string in the format hh:mm and want to compare it with current system time. if the match i want to generate a notification.
This is the code

NOTE:
THE STRING str holds time.

```
     time = days+1;
    while(i>0)
    {    
    long hour=calendar.get(calendar.HOUR_OF_DAY);
    long min=calendar.get(calendar.MINUTE);
    String str = alarm[time];
    SimpleDateFormat formatter = new SimpleDateFormat("hh:mm");
    try {
       Date date = (Date)formatter.parse(str);
       Calendar c2 = GregorianCalendar.getInstance(); // creates a new calendar instance
       c2.setTime(date);   // assigns calendar to given date 
       hours=c2.get(Calendar.HOUR_OF_DAY); // gets hour in 24h format
        minutes=c2.get(Calendar.MINUTE);   
        if(hours==hour && min==minutes)
            {
            builder.setContentIntent(contentIntent)
            .setSmallIcon(R.drawable.ic_books)
            .setLargeIcon(BitmapFactory.decodeResource(res, R.drawable.ic_launcher))
            .setTicker(res.getString(R.string.Cal))
            .setWhen(System.currentTimeMillis())
            .setAutoCancel(true)
            .setContentTitle("You Have a Lecture !!")
            .setContentText(alarm[time+1]);
            Notification n = builder.build();
            nm.notify(0, n);                                            
            }
        i--;
        time=time+days;
        } catch (java.text.ParseException e) {
            e.printStackTrace();
            }
        }

```

but i get a

```
java.lang.ClassCastException: java.util.Date cannot be cast to java.sql.Date

```

please help.