Android Application Development (AND-401) — Question 42
Which of the following classes should be extended to create a custom view?
Answer options
- A. View
- B. ViewGroup
- C. Context
- D. Activity
Correct answer: A
Explanation
The correct answer is A, as the View class serves as the base class for all UI components in Android. While ViewGroup is used for layouts containing other views, Context is for accessing application-specific resources, and Activity is for managing an application's UI lifecycle, they are not the right choices for creating a custom view.