I have a handler in android defined as this :
myHandler = new Handler(Looper.getMainLooper()){
@Override
public void handleMessage(Message msg){
switch (msg.what){
case 1:
break;
case 5:
break;
case 4:
break;
case 3:
break;
default:
super.handleMessage(msg);
}
}
};
Now what is the best way to kill clear this ? Should I use something as they do here: handler.removeCallbacksAndMessages(null); Is it better to do in in onStop()
or onDestroy()
?