From a string array (code below), I want to randomly display one of the strings in a TextView (code below), when a button is pressed (code below). Do I have to use an onClick"sendMessage" and then a random string generator? How would I do this in Java? Many thanks!
<resources>
<string-array name="colorArray">
<item>Green</item>
<item>Red</item>
<item>Purple</item>
<item>Blue</item>
<item>Orange</item>
<item>Brown</item>
<item>Yellow</item>
<item>White</item>
<item>Pink</item>
</resources>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="NOT SURE WHAT TO PUT HERE"
android:textSize="76sp"
android:gravity="center"
android:textAllCaps="true"/>
<Button
android:id="@+id/green_button"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/green_button"/>