How to determine which button pressed on android -
I should know, how to identify, which button is pressed, like I have two buttons, button 1 and button 2, and both work in the same way, the method () says, which button is pressed, how is it fixed?
Regards
Follow the most favorable pattern:
Click Public Zero (see V) {Switch (v.getId ()) {Case R.id.button_a_id: // Handle button one click; break; Case R.id.button_b_id: // Click the handle button B; break; Default: throwing new runtime expansions ("Uncountain Button ID"); }
In this way it is very easy to debug and ensures that you are unable to handle any click.
Comments
Post a Comment