Skip to content

Instantly share code, notes, and snippets.

@croach
Created January 1, 2010 18:46
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/267205 to your computer and use it in GitHub Desktop.
Save croach/267205 to your computer and use it in GitHub Desktop.
package com.android.hello;
import android.app.Activity;
import android.os.Bundle;
import android.widget.Button;
import android.widget.TextView;
import android.widget.EditText;
import android.view.View;
import android.view.View.OnClickListener;
public class HelloAndroid extends Activity
{
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final EditText editText = (EditText)findViewById(R.id.edit_text);
final TextView textView = (TextView)findViewById(R.id.text_view);
Button button = (Button)findViewById(R.id.click_here);
button.setOnClickListener(new Button.OnClickListener() {
public void onClick(View v) {
textView.setText(editText.getText());
}
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment