AND-401 Exam QuestionsBrowse all questions from this exam

AND-401 Exam - Question 101


Which of the following is a rule that developers must always follow when writing multi-threaded Android applications? (Choose two)

Show Answer
Correct Answer: CD

In multi-threaded Android applications, it is crucial to follow certain rules to ensure the application performs efficiently and correctly. First, the UI thread must never be blocked because blocking it can make the application appear unresponsive to the user. Long operations, such as network access or database queries, should be performed in worker threads to keep the UI thread free to handle user interactions and drawing events. Second, the Android UI must not be accessed from outside the UI thread because the Android UI toolkit is not thread-safe. Accessing or manipulating UI components from a worker thread can lead to inconsistent states and unpredictable behavior. Therefore, all changes to the user interface must be done from the UI thread.

Discussion

1 comment
Sign in to comment
MmadiOptions: CD
Dec 31, 2022

C. The UI thread must never be blocked. D. The Android UI must not be accessed from outside the UI thread.