I have a dynamically generated array of textviews
for(int i = 0; i < blog_link_counter; i++) {
textViewArray[i] = new TextView(this);
textViewArray[i]
don't have to use R.id.xxx, simply use the same numbers that you used in your loop:
switch(v.getId())
{
case 0:
case 1:
//etc
}
Just call setOnClickListener(OnClickListener) then on each of your TextView
s.
for(int i = 0; i < blog_link_counter; i++) {
textViewArray[i] = new TextView(this);
textViewArray[i].setText(Html.fromHtml(array_blog_text[i]+"<br>"));
textViewArray[i].setId(i);
textViewArray[i].setOnClickListener(listener);
((LinearLayout) linearLayout).addView(textViewArray[i]);
}