Skip to content

Instantly share code, notes, and snippets.

@rafaeltoledo
Created December 22, 2015 12:54
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 rafaeltoledo/a6aa5cdd05ba718ec486 to your computer and use it in GitHub Desktop.
Save rafaeltoledo/a6aa5cdd05ba718ec486 to your computer and use it in GitHub Desktop.
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
private TextView text;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
findViewById(R.id.button).setOnClickListener(this);
findViewById(R.id.hide).setOnClickListener(this);
text = (TextView) findViewById(R.id.text);
}
@Override
public void onClick(View v) {
if (v.getId() == R.id.button) {
text.setText("Hello World!");
} else {
v.setVisibility(View.GONE);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment