I am using a class that extends the Handler class to update the activity UI. The code is as follows:
public class RefreshHandler extends Handler { public void handleMessage(Message msg) { Homeform.this.updateUI(); } public void sleep(long delayMillis) { this.removeMessages(0); sendMessageDelayed(obtainMessage(0), delayMillis); } }; private void updateUI(){ Log.v(""," I am inside Update UUI====================="); refresh(); mRedrawHandler.sleep(5000); }
And I called this handleMessage () method for the RefreshHandler object as follows
mRedrawHandler = new RefreshHandler(); mRedrawHandler.handleMessage(new Message());
But here I ran into one problem that it works even after closing my application.
please solve my problem to stop this handler when closing this application.
Thanks..
source share