yashbinani
yashbinani

Reputation: 387

Button OnClick Event Android

I have a code which is running in the onCreate method of the activity.I even have a button on my screen on click of which some code runs.

I want to know what happens to the code that is running in oncreate method when we click the button. It stops the execution of the currently running code and first executes the code inside onClick method? or what What will be the flow of execution?

Upvotes: 0

Views: 389

Answers (1)

user1204391
user1204391

Reputation: 92

The onCreate code will run before the activity is presented to you. Therefore, first the onCreate code is executed, then your button's code.

Upvotes: 2

Related Questions