Today in the Reading code found Android handlerr.removecallbacksandmessages (null) code in the Ondestory () call, before the use, that want to understand what to do, check the API:
Public final voidremovecallbacksandmessages(Object token)Added in API Level 1
Remove any pending posts of callbacks and sent messages whose obj are token . If token is null, all callbacks and messages would be removed.
This is the Google document interpretation, English is not good, please use Youdao translation,
Delete Whatever the pending post callback function and the obj token that sent the message.
Assuming the token is empty, all of the callback functions and messages will be deleted
Of course, this translation is not very accurate, meaning that when the number of parameters is null, all the callback functions and message are deleted
The advantage of this is that the memory leak can be avoided when the acticity exits
Android handlerr.removecallbacksandmessages (null) magical