Skip to content

Instantly share code, notes, and snippets.

@konk3r
Created September 4, 2013 20:47
Show Gist options
  • Save konk3r/6442657 to your computer and use it in GitHub Desktop.
Save konk3r/6442657 to your computer and use it in GitHub Desktop.
//OnClickListener stub
public class ButtonListener implements OnClickListener {
private UpdateUIListener mUIListener;
public ButtonListener(UpdateUIListener uiListener){
mUIListener = uiListener;
}
@Override
public void onClick(View v) {
switch(v.getId()){
case R.id.other_buttons:
doStuff();
break;
//whatever other buttons you have
case R.id.update_ui_button:
updateUI();
break;
}
}
private void updateUI() {
mUIListener.updateUI("Whatever you want to send to update the UI");
}
public interface UpdateUIListener{
public abstract void updateUI(String text);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment