package com.example.layouts;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

public class HelloXMLActivity extends Activity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.hello);

        Button sayHelloButton = (Button) findViewById(R.id.sayHello);
        sayHelloButton.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                EditText nameEditText =
                        (EditText) findViewById(R.id.name);
                TextView helloTextView =
                        (TextView) findViewById(R.id.hello);

                String name = nameEditText.getText().toString();
                helloTextView.setText("Hello " + name + "!");
            }
        });
    }
}