jeudi 4 juin 2015

Android ArrayList on XML Random

I would like to do a random that randomly picks items from a XML arraylist. I found this answer to a question that almost covers what I would like to do. The problem is that his code is adapted to the question (Randomly picks colours). In my situation, instead of colours, I want to randomly pick images. My XML so far:

<resources>
    <string-array name="colours">
        <item>R.mipmap.blue</item>
        <item>R.mipmap.green</item>
        <item>R.mipmap.red</item>
    </string-array>
</resources>

Basically the images are coloured circles. If anyone could tell me how to adapt his Java to instead of randomly picking colours, picking images, I'm all hears ;) Be patient with me please, I'm a noob programmer.

Thanks in advance!




Aucun commentaire:

Enregistrer un commentaire