I have 4 images. We should be able to click on these images.
I\'d like to know if I have to create 4 OnClickListener
, or there is another way to do this properly?>
You can just do it like this,
phone.setOnClickListener(this);
bookings.setOnClickListener(this);
settings.setOnClickListener(this);
pictures.setOnClickListener(this);
And in the onClick() method,
@Override
public void onClick(View v) {
if(v == phone){
// your stuff
}
else if(v == bookings){
// your stuff
}
else if(v == settings){
// your stuff
}
ese if(v == pictures){
// your stuff
}
}