title: Clarification regarding findViewById(int id) method in Android
body: <p>I am going through Head First Android Development and I am a bit confused with 
  this method --> findViewById(int id)</p>
  
  <p>I have the below button in the file "activity_find_beer.xml" :</p>
  
  <pre><code>&lt;Button
  android:id="@+id/find_beer"
  android:text="@string/find_beer"
  android:onClick="onClickFindBeer" /&gt;
  </code></pre>
  
  <p>and the following code from the class FindBeerActivity.java which is taking the user selected beer and displaying the same in a textview.</p>
  
  <pre><code>public class FindBeerActivity extends Activity {
      @Override
      protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.activity_find_beer);
      }
      //Call when the button gets clicked
      public void onClickFindBeer(View view) {
          //Get a reference to the TextView
      TextView brands = (TextView) findViewById(R.id.brands);
         //Get a reference to the Spinner
      Spinner color = (Spinner) findViewById(R.id.color);
         //Get the selected item in the Spinner
      String beerType = String.valueOf(color.getSelectedItem());
         //Display the selected item
      brands.setText(beerType);
      }
      }
  </code></pre>
  
  <ol>
  <li><p>My Question is the method onClickFindBeer(View view) takes a View type of
  object as a parameter , but in the xml i have just mentioned
  <code>android:onClick="onClickFindBeer"</code> and when the user clicks the
  button , the method onClickFindBeer gets invoked...Who is passing the object of
  type View to the onClickFindBeer(View view) ...is it something
  implicit ? </p></li>
  <li><p>Second,on <a href="http://developer.android.com" rel="nofollow">developer.android.com</a> I see that the method
  <strong>findViewById(int id)</strong> is both in the <strong>Activity class</strong> (
  <a href="https://developer.android.com/reference/android/app/Activity.html" rel="nofollow">https://developer.android.com/reference/android/app/Activity.html</a>
  ) and also in the <strong>View class</strong>
  <a href="https://developer.android.com/reference/android/view/View.html" rel="nofollow">https://developer.android.com/reference/android/view/View.html</a>
  ... It's not clear to me which class (Activity or View)
  findViewById(int id) method is invoked when i call findViewById()
  from onClickFindBeer(View view){}.</p></li>
  </ol>
  
  <p>Would be highly obliged if someone could throw light on this.</p>
  
  <p>Regards.</p>