-1

Even after googling for long, I couldn't find the solution to my problem.

Problem is:

In my application, I launch an intent which call the file implementing intentService on click of toggle button and runs it at regular interval since startService() is inside the timertask. Now when I click on toggle button again, it stops the intent which it is supposed to do. But now the next time without closing the application when I click on toggle button again (start again) then it start 3 threads of intents instead of only new one.

I am not able to figure out what could be the reason and how can i solve it, Any help would be highly appreciable

David Wasser
  • 93,459
  • 16
  • 209
  • 274

1 Answers1

0

Ok so finally, I figured out what the problem was. I just added a command

timer.cancel

on click of toggle button to stop the process and it worked like a charm. Thanks