Skip to content

Instantly share code, notes, and snippets.

@januprasad
Last active February 17, 2020 15:13
Show Gist options
  • Save januprasad/41f33e8f64ca61bca1fc17e0728acc3e to your computer and use it in GitHub Desktop.
Save januprasad/41f33e8f64ca61bca1fc17e0728acc3e to your computer and use it in GitHub Desktop.
/**
* On Click Button call for Time Set
*/
fun showTimerPickerFragment(view: View) {
val timePickerFragment = TimePickerFragment()
timePickerFragment.show(supportFragmentManager, "time_picker")
}
/**
* On Click Button for Cancel the previously set alarm
*/
fun cancelAlarm(view: View) {
val alarmManager = getSystemService(Context.ALARM_SERVICE) as AlarmManager
val intent = Intent(this, AlarmReceiver::class.java)
val pendingIntent = PendingIntent.getBroadcast(this, 0, intent, 0)
alarmManager.cancel(pendingIntent)
alarm_time_text.text = getString(R.string.time_dosent_set)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment