例 私は 3 つのボタンを持っています
<Button
android:id="@+id/q1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Button
android:id="@+id/q2"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Button
android:id="@+id/q3"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
そして、私は以下のようにランダムにするテキストを持っています
private static final String[] answers = {"a", "b", "c", "Vowel", "d", "e", "f"};
String q = answers[rgenerator.nextInt(answers.length)];
button1.setText(q);
button2.setText(q);
button3.setText(q);
例 アクティビティをランダムに 5 回開始します。
1st activity start random look like: a, c, Vowel
2st activity start random look like: b, Vowel, a
3st activity start random look like: Vowel, e, b
4st activity start random look like: a, e, Vowel
5st activity start random look like: Vowel, b, f
アクティビティの開始時は常に、アクティビティの更新/開始時に 3 つのボタンのうちの 1 つに「Vowel」setText を設定する必要があります。
私は本当にそれに立ち往生しています..