Android Application Development (AND-401) — Question 100
Which of the following is a rule that developers must always follow when writing multi-threaded Android applications? (Choose two)
Answer options
- A. A worker thread must not be created from inside the UI thread.
- B. Each UI thread must not create more than one worker thread.
- C. The UI thread must never be blocked.
- D. The Android UI must not be accessed from outside the UI thread.
Correct answer: C, D
Explanation
The correct answers are C and D because the UI thread must remain responsive and should not be blocked to ensure a smooth user experience. Additionally, accessing the Android UI from outside the UI thread can lead to exceptions and unpredictable behavior, making D a critical rule to follow. Options A and B are not correct as they do not represent universal rules for multi-threaded development in Android.