Display a random image when a button is clicked

前端 未结 4 1813
离开以前
离开以前 2021-01-23 07:59

I tried earlier and just got more confused so i will try and be more precise. I am making an app in which i have a deck of 7 cards. I want to click on the deck and have one of

4条回答
  •  粉色の甜心
    2021-01-23 08:18

    Your question is kind of ambiguous, but with whatever little I understood, I suggest,if you are sure of having only 7 decks, why dont you hardcode them and assign a value to each of them. So that when you call random function, it will check which number is the result, suppose it is 5, then call setDrawableResource(R.drawable.img5) and so on.

提交回复
热议问题