declaring a single onClick function for all instead of using all innerClass stuff
first we need to implements View.OnClickListener
then in the onClick funtion which recives View as parameter
we need to setup swich Case to know which element has been clicked
so in the the switch case we need to write
switch(view.getId())
{
case R.id.b1: .......;break;
case R.id.b2: .......;break;
}
first we need to implements View.OnClickListener
then in the onClick funtion which recives View as parameter
we need to setup swich Case to know which element has been clicked
so in the the switch case we need to write
switch(view.getId())
{
case R.id.b1: .......;break;
case R.id.b2: .......;break;
}
No comments:
Post a Comment