Android - Button Listener Knows Which Button Was Clicked
<p>I'm assigning a button listener to multiple buttons like so:</p>

<pre><code>    for(Button b : buttons)
    {
        b.setOnClickListener(clicklisten);
    }
</code></pre>

<p>The button listener is defined as follows:</p>

<pre><code>private OnClickListener clicklisten = new OnClickListener()
{
    public void onClick(View v)
    {
        Context context = getApplicationContext();
        text = Toast.makeText(context, " Button Clicked", Toast.LENGTH_SHORT);
        text.show();
    }
};
</code></pre>

<p>As it is, it just shows a Toast with "Button Clicked" displaying. I'd like it to detect which button is clicked, perhaps via the name or ID of that button (as defined in the XML), and display something based on that. Is it possible to retrieve that information through the code this way?</p>
