Display a random image when a button is clicked

前端 未结 4 1809
离开以前
离开以前 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:05

    You shoud be using ImageView instead of MediaPlayer. You should assigned 7 images(R.drawables.mythos1, ...) assigened to 1-7 and set it to ImageView imageView.setDrawableResource(R.drawable.myths1); depending on the random number. Look at example from here Get the ID of a drawable in ImageView

提交回复
热议问题