• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Dismissing Alarm when user uses Back or Home

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am building an alarm app and have run into a problem I can't seem to find the answer to. Here is the problem... Everything works as expected except when a user uses the Back or Home button while the alarm is playing. The dismiss Alarm dialog closes but the alarm keeps playing with no way to stop it other than forcing the program to close in Settings. I have tried stopping the mediaplayer in the onPause and onStop methods. This causes proper behavior if the device is awake, but if asleep it prevents the alarm from playing at all when woken up. If the device is asleep, the alarm dialog pops up, but the alarm makes a brief noise and stops.

I am sooooo close to getting this working right and I'm thinking that there is something simple I'm overlooking. I have searched for days high and low on the Internet and cannot come up with anything that helps.

Here is the AlarmScreen activity

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic