package app.test; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; public class Test extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setTitle("EditTextActivity"); setContentView(R.layout.main); find_and_modify_text_view(); } private void find_and_modify_text_view() { Button get_edit_view_button = (Button) findViewById(R.id.get_edit_view_button); get_edit_view_button.setOnClickListener(get_edit_view_button_listener); } private Button.OnClickListener get_edit_view_button_listener = new Button.OnClickListener() { public void onClick(View v) { EditText edit_text = (EditText) findViewById(R.id.edit_text); CharSequence edit_text_value = edit_text.getText(); setTitle("EditText:" + edit_text_value); } }; } //main.xml android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> android:layout_height="wrap_content" android:text="Input text here" /> android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Get value from EditView" />