title: Text view doesn't show after button click - Android
body: <p>I have a problem with Text View and Button in Android Studio. I would like to update my text view when i clik a button but it doesn't work.
  This is my code:</p>
  
  <p>activity_distance_to_run.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;android.support.constraint.ConstraintLayout 
  xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:app="http://schemas.android.com/apk/res-auto"
  xmlns:tools="http://schemas.android.com/tools"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  tools:context=".MainActivity"
  tools:layout_editor_absoluteY="25dp"&gt;
  
  
  &lt;TextView
      android:id="@+id/Distancerun2"
      android:layout_width="126dp"
      android:layout_height="50dp"
      android:layout_marginTop="50dp"
      android:text="Distance to ....."
      android:textSize="14sp"
      app:layout_constraintEnd_toEndOf="parent"
      app:layout_constraintStart_toStartOf="parent"
      app:layout_constraintTop_toTopOf="parent" /&gt;
  
  &lt;Button
      android:id="@+id/distancetorun"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_marginEnd="10dp"
      android:layout_marginRight="10dp"
      android:text="run"
      app:layout_constraintBaseline_toBaselineOf="@+id/distancetoride"
      app:layout_constraintEnd_toStartOf="@+id/distancetoride"
      app:layout_constraintStart_toStartOf="parent" /&gt;
  
  &lt;Button
      android:id="@+id/distancetoride"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_marginEnd="9dp"
      android:layout_marginRight="9dp"
      android:layout_marginTop="32dp"
      android:text="ride a bicycle"
      app:layout_constraintEnd_toStartOf="@+id/distancetoswim"
      app:layout_constraintStart_toEndOf="@+id/distancetorun"
      app:layout_constraintTop_toBottomOf="@+id/Distancerun2" /&gt;
  
  &lt;Button
      android:id="@+id/distancetoswim"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="swim"
      app:layout_constraintBaseline_toBaselineOf="@+id/distancetoride"
      app:layout_constraintEnd_toEndOf="parent"
      app:layout_constraintStart_toEndOf="@+id/distancetoride" /&gt;
  
  &lt;Button
      android:id="@+id/yes"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_marginLeft="32dp"
      android:layout_marginStart="32dp"
      android:text="I did it !!"
      app:layout_constraintBaseline_toBaselineOf="@+id/no"
      app:layout_constraintStart_toStartOf="parent" /&gt;
  
  &lt;Button
      android:id="@+id/no"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_marginBottom="116dp"
      android:layout_marginEnd="16dp"
      android:layout_marginRight="16dp"
      android:text="I don't want to do it !!"
      app:layout_constraintBottom_toBottomOf="parent"
      app:layout_constraintEnd_toEndOf="parent"
      app:layout_constraintTop_toBottomOf="@+id/textView1" /&gt;
  
  &lt;TextView
      android:id="@+id/textView1"
      android:layout_width="0dp"
      android:layout_height="0dp"
      android:layout_marginBottom="23dp"
      android:layout_marginEnd="25dp"
      android:layout_marginLeft="25dp"
      android:layout_marginRight="25dp"
      android:layout_marginStart="25dp"
      android:layout_marginTop="221dp"
      android:autoText="true"
      android:clickable="true"
      android:enabled="false"
      android:freezesText="false"
      android:text="Elo ziomek"
      android:textSize="24sp"
      app:layout_constraintBottom_toTopOf="@+id/no"
      app:layout_constraintEnd_toEndOf="parent"
      app:layout_constraintStart_toStartOf="parent"
      app:layout_constraintTop_toTopOf="parent" /&gt;
  
  &lt;/android.support.constraint.ConstraintLayout&gt;
  </code></pre>
  
  <p>distancetorun.java</p>
  
  <pre><code>package pl.agcode.sqliteexample;
  import android.os.Bundle;
  import android.app.Activity;
  import android.view.View;
  import android.widget.Button;
  import android.widget.TextView;
  
  public class distance_to_run extends Activity {
  Button distancetorun;
  TextView txtView;
  
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_distance_to_run);
      distancetorun = (Button) findViewById(R.id.distancetorun);
      txtView = (TextView) findViewById(R.id.textView1);
      distancetorun.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              txtView.setText("NewText");
          }
          });
      }
  }
  </code></pre>
  
  <p>Thanks for help I will try to repair it but don't know how.
  This is very important to repair this for me. :)</p>