Skip to content

Instantly share code, notes, and snippets.

@tobiasstraub
Created November 22, 2014 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tobiasstraub/79504869e5cd46573f2b to your computer and use it in GitHub Desktop.
Save tobiasstraub/79504869e5cd46573f2b to your computer and use it in GitHub Desktop.
Android: OnClickListener for Button onClick event
Button aButton = (Button) findViewById(R.id.theButton); // Id of the Button in the Activity layout
aButton.setOnClickListener(new OnClickListener() {
@Override // Override from OnClickListener class
public void onClick(View v) {
// TODO: What should happen when the button is clicked?
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment