Why do we need to pass View objects to some methods?
<p>I am new to android and have very few experience in Java. I don't understand why some methods require View objects.</p>

<p>This is a method which is called when a button is clicked on an activity.</p>

<pre><code>public void eatCookie(View view) { //Example code inside

    ImageView previous = (ImageView) findViewById(R.id.android_cookie_image_view);
    previous.setImageResource(R.drawable.after);
    TextView previousText = (TextView) findViewById(R.id.status_text_view);
    previousText.setText("I'm so full!");
    }
</code></pre>

<p>In this code, there is no line which uses the view object. This code is from a udacity tutorial. Why could they have not formed the "eatCookie" method like this:</p>

<pre><code>public void eatCookie() {.....}
</code></pre>