Skip to content

Instantly share code, notes, and snippets.

@scttymn
Last active December 18, 2015 07:00
Show Gist options
  • Save scttymn/5743764 to your computer and use it in GitHub Desktop.
Save scttymn/5743764 to your computer and use it in GitHub Desktop.
public class MainActivity extends Activity implements View.OnClickListener {
@Override
protected void onCreate(Bundle savedInstanceState) {
Button clickMe = (Button) findViewById(R.id.button_name);
clickMe.setOnClickListener(this);
}
@Override
public void onClick(View view) {
if(view.getId() == R.id.button_name) {
// handle button click event. Since the view in this scope, is your
// button, you could change the text on it here.
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment