How can it be, that then i launch this code, text changes in the button?? Explain please. i took recomendations from here. I need that the button has text "Click me" and the textview "Hello". instead of that i become nothing in the textview and "Hello" in the button.

In layout:

 <Button
        android:id="@+id/button1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        android:text="Click me" />

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="76dp" />

In Activity:

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_hello_android);

    TextView textView = (TextView) findViewById(R.id.textView1);
    textView.setText("Hello");

}
有帮助吗?

解决方案

I had to clean the project. Thanks to all!

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top