Как изменить текст TextView, нажав кнопку

Я хочу изменить TextView , нажав ] Button , но не понимаю, как это сделать правильно.

Это часть моего макета:

<TextView android:id="@+id/counter"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Text" />
<Button android:id="@+id/button"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Change text!" />

И это мое действие:

public class Click extends Activity {
    protected void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        setContentView(R.layout.main);
        final Button button = (Button) findViewById(R.id.button);
        button.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                // Perform action on click
                // ???
            }
        });
    }
}

Что я должен поместить внутрь onClick () метод?

11
задан Roman 11 February 2012 в 06:27
поделиться