Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Ask for confirmation from android service

 
Manish Hatwalne
Ranch Hand
Posts: 2595
Android Firefox Browser Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is what I am trying to do :

I have a service that has a certain listener. Once that event occurs - the service wants to do some processing (say doStuff()), but before the service starts to do this processing, I want to ask user if he wants to cancel it (Through activity with dialogue theme) . So if user wants to cancel, he can do it in 30 seconds - if not cancelled; the service will start with the processing.

What is the best approach to accomplish this? I can show Activity with cancel button from service - but not sure how can I process user inputs or finish activity after specified time. Any pointers would be highly appreciated!

Thanks!
- Manish
 
Manish Hatwalne
Ranch Hand
Posts: 2595
Android Firefox Browser Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Never mind - I figured out. Moved large chunk of code from Service to Activity and called Dialog from activity for my confirmation. Works great! :-)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic