When We Need To Override Handler's Handlemessage() Method
I was learning about Looper and Handler and most time I read about it that it use to Communicate with UI thread. But then I saw the code which was child class of Handler with handl
Solution 1:
The sendMessage(...) call is used when you want message.obj to be some custom class, to send it to potentially another thread for processing. This is normally done by having message.what be an ID, and knowing the object type for that particular id's message.obj, then casting to that object type. This is used in many places throughout the Android framework, for example check the BluetoothStateMachine and how they handle processMessage(Message msg)
in each one of their state classes. Each one of these states is delegated to by Handler.
Post a Comment for "When We Need To Override Handler's Handlemessage() Method"