Android, setonclicklistner to dynamically generated array of textviews

后端 未结 2 408
梦如初夏
梦如初夏 2021-01-15 19:11

I have a dynamically generated array of textviews

for(int i = 0; i < blog_link_counter; i++) {
textViewArray[i] = new TextView(this);
textViewArray[i]         


        
2条回答
  •  无人及你
    2021-01-15 19:52

    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
    }
    

提交回复
热议问题