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
//xml
<TextView android:id="@+id/textView2" android:text="blah blah blah"></TextView>
<Button android:text="Wrong answer." android:onClick="wrongAns" android:clickable="true"></Button>
//code
TextView theCorrectAnsTextView = (TextView)findViewById(R.id.textView2);
public void wrongAns(View v)
{
theCorrectAnsTextView.setText("TextView text has changed!");
}
wrongAns(View v)
function called? Please provide more details.