Skip to content

Instantly share code, notes, and snippets.

@jshvarts
Created July 1, 2017 23:05
Show Gist options
  • Save jshvarts/ab75b3d9ff60f518c27741409a44f911 to your computer and use it in GitHub Desktop.
Save jshvarts/ab75b3d9ff60f518c27741409a44f911 to your computer and use it in GitHub Desktop.
public class ViewModelDemoActivity extends LifecycleActivity {
@BindView(R.id.click_count_text)
protected TextView clickCountText;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_viewmodel_demo);
ButterKnife.bind(this);
}
@OnClick(R.id.increment_button)
public void incrementClickCount(View button) {
int currentClickCount = Integer.parseInt(clickCountText.getText().toString());
clickCountText.setText(String.valueOf(++currentClickCount));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment