@Override public void onClick(View v) { ImageButton b = (ImageButton) v; currentState.clickResponse(); // switch to next state currentState = currentState.nextState(); b.setImageResource(currentState.getImage()); }
public AudioButton(Uri data, Context context) { super(context); audioData = data; playButton = new PlayState(); stopButton = new StopPlayState(); currentState = playButton; this.setImageResource(currentState.getImage()); this.setOnClickListener(stateClick); }