Hi, I want to set the alarm from the selected date and time from date and time picker in android. But I am not able to do.My code is as follows: mHour,mDay,mMinute etc are values from date and time picker. Calender ca; ca=Calendar.getInstance(); ca.clear(); ca.setTimeInMillis(System.currentTimeMillis());
ca.set(Calendar.YEAR, mYear); int month=mMonth+1; ca.set(Calendar.MONTH,month); ca.set(Calendar.DAY_OF_MONTH,mDay); ca.set(Calendar.HOUR,mHour); ca.set(Calendar.AM_PM, Calendar.PM); ca.set(Calendar.MINUTE,mMinute); ca.set(Calendar.SECOND, 0); showNotification(); } protected void showNotification() { pendingIntent = PendingIntent.getService(AddPrescriptionDaily.this, 0, new Intent(AddPrescriptionDaily.this, AlarmService_Service_Daily.class), 0); AlarmManager am = (AlarmManager)getSystemService(ALARM_SERVICE); am.set(AlarmManager.RTC_WAKEUP, ca.gettimeinmillisec(), pendingIntent); Toast.makeText(this, "Alarm set for:"+ca, Toast.LENGTH_LONG).show(); } Using above code I am not able to set the alarm.If instead of "ca.set" I use ca.add((somevalue) then its work. I searched a lot.Everyone is telling to use the set method only but I am not getting any help. Please help me as it is very urgent. Regards Dileep -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en