Created
September 4, 2013 20:47
-
-
Save konk3r/6442657 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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