大家好,所以我正在寻找一种通过名称和随机生成的数字查找视图的好方法。
所以,我有一个列表,看起来像这样
imageView1
...
imageView8
我使用此代码
public void dropIn(View view) { // This is onClick method called with all my imageViews
ImageView counter = (ImageView) view; // I get the clicked image
int defendPosition = defend(); /// random generated number
// Now I need to get another image by a random number so I can work with it
counter = findViewById(R.id.+"imageView"+defendPosition); // I haven't figured a solution for this