Skip to content

Instantly share code, notes, and snippets.

@gskielian
Created August 17, 2014 19:25
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 gskielian/824f9037a7ba087bb82e to your computer and use it in GitHub Desktop.
Save gskielian/824f9037a7ba087bb82e to your computer and use it in GitHub Desktop.
Hello World: Button-TextView Update Android : )
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button doStuffButton = (Button) findViewById(R.id.do_stuff_button);
TextView myTextView = (TextView) findViewById(R.id.textView1);
//remember lowerCamelCase for buttons
doStuffButton.setOnClickListener(new View.OnClickListener() {
//here we send the user to the next activity
@Override
public void onClick(View view) {
myTextView.setText("Shabaka!");
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment