Randomize string from resources android

前端 未结 2 370
忘了有多久
忘了有多久 2021-01-24 18:12

I have tried this:

   int[] trivias = {
        R.string.trivia1, R.string.trivia2, R.string.trivia3, R.string.trivia4, R.string.trivia5,
        R.string.trivi         


        
2条回答
  •  囚心锁ツ
    2021-01-24 19:02

    You are not pass int trivias:-

    tv.setText(trivias[ran.nextInt(trivias.length)]);
    

    You just forgot to trivias[]

提交回复
热议问题