I am using a code that changes the text in my TextView every 5 seconds, the problem is that it changes in the order of the Array (ex. 1,2,3,4,5) I want to make it random like (ex. 2,1,4,3,5).
final TextView textView = (TextView) findViewById(R.id.tvTitleeee);
final int[] array = {R.string.text1, R.string.text2,R.string.text3,R.string.text4,R.string.text5};
textView.post(new Runnable() {
int i = 0;
@Override
public void run() {
textView.setText(array[i]);
i++;
if (i ==5)
i = 0;
textView.postDelayed(this, 5000);
}
});
Aucun commentaire:
Enregistrer un commentaire