Android Application Development (AND-401) — Question 56
Which of following is incorrect about the Toast class?
Answer options
- A. You cannot set a custom layout for a Toast.
- B. A Toast can only be created by an Activity class
- C. There is no need to close or hide a Toast, since it closes automatically.
- D. A Toast is displayed for only one of the following periods: Toast.LENGHT_SHORT or Toast.LENGTH_LONG
Correct answer: B
Explanation
The correct answer is B because a Toast can be created from any context, not just an Activity. Options A, C, and D are correct statements regarding the Toast class functionality.