title: Button on click listener
body: <p>I come from the iOS world and just started with Android. I followed a java training so I know how to create a method, but I don't get the action one. </p>
  
  <p>What I would like to do is to create a method action from a button and I can't find anywhere how to do that (obviously looking in the wrong place). When I click on button 1, I want to create a method with inside only a=1 and when I click on button 2, I want a=2 (then I can decide what to do when a is 1 or 2).</p>
  
  <p>I created my buttons in Acitivity_main.xml and gave a method name in OnClick, but that's as far as I went.</p>
  
  <p>It seems to be so basic to do when I compare with iOS that I don't understand why I can't find how to do it.</p>
  
  <p>Would a nice soul point me in the right direction for creating an action please?</p>