Junior — Middle
In which data structure does the Looper store messages received through Handler?
sobes.tech AI
Answer from AI
Looper in Android stores messages received via Handler in a data structure called MessageQueue. This message queue ensures the sequential processing of messages and Runnable objects within a thread.
When a Handler sends a message, it is placed in the MessageQueue, and the Looper retrieves and processes them in order within its loop. The MessageQueue is implemented as a linked list of messages (Message), ordered by execution time.
Thus, the MessageQueue is the main data structure managing the order of message processing in the Looper.