I just want to know what is the exact difference between using sendMessage (Message msg)
and post (Runnable r)
.
Since both these methods are going to run in Main UI Thread even if we have Seperate Runnable.
I just want to know what is the exact difference between using sendMessage (Message msg)
and post (Runnable r)
.
Since both these methods are going to run in Main UI Thread even if we have Seperate Runnable.
Behind the scenes they actually call the same code. SO it isn't a big concern. SendMessage may be slightly more efficient (fewer objects used because the post will create a Message object), but by so little as to not matter at all. Using sendMessage you can add a data object as well as a runnable, but you can do that with a Runnable if you aren't using an anonymous one and pass it in via constructor.
So the long and short of it is there isn't much of one. Use whichever is more convenient (which tends to be post).
© 2022 - 2024 — McMap. All rights reserved.