title: Changing TextView text on button click (Android)
body: <p>I am trying to change text of a textview on a button click. Below is the gist of my code but it doesnt seem to work. Am i doing something wrong. Thanks in Advance </p>
  
  <pre><code>//xml
  &lt;TextView android:id="@+id/textView2" android:text="blah blah blah"&gt;&lt;/TextView&gt;
  &lt;Button android:text="Wrong answer." android:onClick="wrongAns" android:clickable="true"&gt;&lt;/Button&gt;
  
  //code
  TextView theCorrectAnsTextView = (TextView)findViewById(R.id.textView2);
  
  public void wrongAns(View v) 
  {   
    theCorrectAnsTextView.setText("TextView text has changed!");
  }
  </code></pre>