Nhật Hương
Member
When a button is clicked which listener you can use?
Answer
If you have more than one button click event, you can use switch case to identify which button is clicked. Link the button from the XML by calling findViewById() method and set the
onClick listener
by using setOnClickListener() method. setOnClickListener takes an OnClickListener object as the parameter.
Answer
If you have more than one button click event, you can use switch case to identify which button is clicked. Link the button from the XML by calling findViewById() method and set the
onClick listener
by using setOnClickListener() method. setOnClickListener takes an OnClickListener object as the parameter.