I'm trying to read the time of the next alarm, but I keep getting the following error code on the console:
E/Handler: Failed to handle callback; interface not implemented, callback:android.view.View$PerformClick@40e45bd8
java.lang.NoSuchMethodError: android.app.AlarmManager.getNextAlarmClock
Setting the alarm works fine, the alarm then triggers at the specified time, it's just that I need to get the time when it will trigger again to use it elsewhere.
The relevant code is below. In case you wonder: I'm now trying to read the alarm immediately after setting it order to debug.
// Copy data from the time picker to the calendar
calendar.set(Calendar.HOUR_OF_DAY, hours);
calendar.set(Calendar.MINUTE, minutes);
// Create a pending intent that delays the intent until the specified time
pending_intent = PendingIntent.getBroadcast(MainActivity.this, 0,
alarm_intent, PendingIntent.FLAG_UPDATE_CURRENT);
// Set the alarm manager
alarm_manager.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), pending_intent);
// Read the alarm setting
long nextLong= alarm_manager.getNextAlarmClock().getTriggerTime();
String nextAlarm = Long.toString(nextLong);
Log.e("Next Alarm:", nextAlarm);
Toast.makeText(context, nextAlarm, Toast.LENGTH_LONG).show();
Any ideas? Thanks in advance.