When inflating a layout xml dynamically multiple times, how can I differentiate or identify the Button widgets?
<p>I am inflating an xml having button, multiple times and i am able to do so perfectly but the problem is when I click the button,i want to show which button is clicked.</p>

<pre><code>   public class InflateExActivity extends Activity implements OnClickListener {
    /** Called when the activity is first created. */

    Button b;


    LinearLayout lLayout;
    LayoutInflater inflater;

    @Override
    public void onCreate(Bundle savedInstanceState) {


        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        for (int i = 0; i &lt; 3; i++) {

             inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
             b = (Button) inflater.inflate(R.layout.buttons, null);
            t = (TextView) inflater.inflate(R.layout.texts, null);


            b.setTag(i); // you'll get 0,1,2 as

            lLayout = (LinearLayout) findViewById(R.id.layout1);
            lLayout.addView(b);

            b.setOnClickListener(this);

        }

    }

    public void onClick(View v) {

        }

}
</code></pre>
