When you are in onCreate()
, you are registering your buttons's onClick
event into the anonymous class View.OnClickListener()
.
Now this class has a method (onClick()
) that is waiting for the button click event to occur.
Now imagine as you have asked a person to do a task when particular event will occur.
In this case you have asked a "View.OnClickListener()" person to do a task "onClick()" when button click occurs.
Now even if you are in onResume(), and user presses that button, the "person" will be notified about the event and will perform the task i.e. "onClick()".
So it does not matter if you are in onCreate or onResume once you register your button with onClickListener.