0

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");

}
Community
  • 1
  • 1
  • What do you need to do? Once you click on the button do you need to change the text in TextView? – IBunny Feb 13 '14 at 22:53
  • 1
    Could you be more specific about your problem? It's unclear what it is you are trying to do. Also, I ran that code and the text of the button stays the same, if that was your "problem". – pedromss Feb 13 '14 at 22:54
  • added what i want and what i have –  Feb 13 '14 at 22:57
  • 1
    ^ If your layout `activity_hello_android` is correct one, then you may try cleaning the project just for the sake of being safe. – Shobhit Puri Feb 13 '14 at 23:11

1 Answers1

0

I had to clean the project. Thanks to all!