I faced with trivial problem but i don’t know how to solve it. I have several ImageViews on my TableLayout how can i create one onClickListner for all of them. It should looks like this :
public void onClick(View v) {
switch(v.getId())
{
case(R.id.imageStart):
{
this.startActivity(new Intent(MainActivity.this,GameActivity.class));
break;
}
case(R.id.imageExit):
{
finish();
break;
}
}
}
If it’s possible or course, i am new in Android Dev. I saw sample where for each ImageView have his own onClickListner but its not a good practice i suppose. Thanks.
follow this Steps :