Skip to content

Instantly share code, notes, and snippets.

@krugloid
Created March 29, 2016 06:12
Show Gist options
  • Save krugloid/06daa3957e3cc948db00 to your computer and use it in GitHub Desktop.
Save krugloid/06daa3957e3cc948db00 to your computer and use it in GitHub Desktop.
TextView mCounterText;
Button mCounterIncrementButton;
int mClicks = 0;
public void onCreate(Bundle b) {
super.onCreate(b);
mCounterText = (TextView) findViewById(R.id.tv_clicks);
mCounterIncrementButton = (Button) findViewById(R.id.btn_increment);
mCounterIncrementButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
mClicks++;
mCounterText.setText(""+mClicks);
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment