dynamic button onclick event inside for loop
<p>i'm using this code to create dynamic buttons within for loop.. </p>

<pre><code>LinearLayout linearLayout =  (LinearLayout)findViewById(R.id.linearLayout2);
for (int i=0 ; i&lt;10; i++){
LinearLayout l = new LinearLayout(this);
l.setOrientation(LinearLayout.HORIZONTAL);

TextView textview = new TextView(this);
textview.setText("Text view" + i);
textview.setId(i);

l.addView(textview);
Button button = new Button(this);
button.setText("View");
button.setId(i);
button.setWidth(90);
button.setHeight(60);
l.addView(button);
linearLayout.addView(l);//if you want you can layout params linearlayout
}
</code></pre>

<p>now i want to add onclick event to each button based on the iterating i value.. can any one suggest me how to implement this... thanks in advance..</p>
