Slide 26
Slide 26 text
#andevcon
Inversion of Control via Interface
/**
* Contract between caller and receiver for red buttons
*/
public interface RedButtonListener {
void onRedButtonClick();
}
@Override
public void onRedButtonClick() {
Toast.makeText(this, R.string.red_button_clicked, Toast.LENGTH_SHORT).show();
}
in Activity
redButtonListener.onRedButtonClick();
in Fragment
RedButtonListener.java