I have a button and a few strings.
How do I make that when I click the button, a string changes random to another string? I'm not sure what part of code I should copy in here...
Button:
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/txt_example1"
android:layout_centerHorizontal="true"
android:background="@drawable/button_newfact"
android:minHeight="38dip"
android:minWidth="74dp"
android:onClick="OnButtonClickChangeTextOfTextView" />
This is something in the MainActivity.java I made with a YouTube tutorial. But it only changes to a new text, and not another string. And it isn't random.
public void OnButtonClickChangeTextOfTextView(View view)
{
TextView textView = (TextView)findViewById(R.id.txt_example1);
textView.setText("");
}
I hope you can help me. I wish you all a nice third advent. :)