Exam AND-401 All QuestionsBrowse all questions from this exam
Question 56

Which of following is incorrect about the Toast class?

    Correct Answer: B

    A Toast can be created by the Context class, which is not limited to just Activity. Instances like Service can also display Toast messages. This makes the statement 'A Toast can only be created by an Activity class' incorrect. Toasts indeed don't need to be explicitly closed as they disappear automatically after a short duration, and they cannot have a custom layout. Additionally, Toasts are displayed for predefined durations specified by Toast.LENGTH_SHORT or Toast.LENGTH_LONG.

Discussion
MmadiOption: B

B. A Toast can only be created by an Activity class