Just set onClick
in the XML, it’s much easier.
android:onClick="whatever"
Then in your class,
public void whatever(View v) {
// Do your stuff
}
You do not need all this:
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
image.setImageResource(R.drawable.player_pause);
}
});
1
solved button.setOnClickListener not working