I created a chat application in android
and for refreshing and getting new messages from otherside person, i used a TimerTask
which runs a asynctask each 10 second... My problem is when i close this activity, timer task wont destroy and stop! even i put the code Timertask.cancel()
in onStop() onPause and onDestroy() i put even some Log to see this methods work or not... but i realize that nothing of them called and timertask running for ever... even when i close the app!!!
My question is, when i use this TimerTask and AsyncTask which i mentioned it, why those methods such as onStop(), onPause() and onDestroy() are never called???
What should i do for solve this problem. Any other suggestion...?
thanks in advance...