I\'m using a Button
just follow this code i hope it's really helpful for you..
boolean isIconChange;
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
isIconChange = !isIconChange;
if(isIconChange){
button.setCompoundDrawablesWithIntrinsicBounds(R.drawable.like, 0, 0, 0);
button.setTextColor(Color.BLACK);
} else {
button.setCompoundDrawablesWithIntrinsicBounds(R.drawable.dislike, 0, 0, 0);
button.setTextColor(Color.RED);
}
}
});