Skip to content

Instantly share code, notes, and snippets.

@croach
Created January 1, 2010 18:44
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 croach/267202 to your computer and use it in GitHub Desktop.
Save croach/267202 to your computer and use it in GitHub Desktop.
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
final EditText editText = new EditText(this);
editText.setWidth(240);
final TextView textView = new TextView(this);
Button button = new Button(this);
button.setText("Click Me");
button.setOnClickListener(new Button.OnClickListener() {
public void onClick(View v) {
textView.setText(editText.getText());
}
});
LinearLayout form = new LinearLayout(this);
LinearLayout main = new LinearLayout(this);
main.setOrientation(LinearLayout.VERTICAL);
form.addView(editText);
form.addView(button);
main.addView(form);
main.addView(textView);
setContentView(main);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment