bt.setOnClickListener will register your click-listener (new View.OnClickListener() {..} on the button and thus, whenever the button is clicked, the onClick() method of your click-listener is executed.
The Android docs have a more detailed explanation
2
solved Oncreate function is called once then why can the button work again and again?