Junior — Middle
After rendering is complete, to which method is control passed for displaying the View?
sobes.tech AI
Answer from AI
In Android, after the rendering of the user interface is complete, control is transferred to the onDraw(Canvas canvas) method of the View component. This method is called by the system to display the View's content on the screen.
If we are talking about the Activity lifecycle, then after creating and setting the layout, control for displaying the View occurs in the onResume() method, but the actual drawing happens in onDraw.
Example of overriding the method for a custom View:
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
// Draw the content of the View here
}