I'm working on an app that deals with playing cards. Right now, I have a folder, drawable/cards that has dozens of files, numbered sequentially from 00.png, that are images of the card faces.
I also have two classes, Deck and Card. Cards have a reference to the Drawable image of their face. Deck has a list of Cards that I would like to construct within a for loop. This all looks like,
public class Card{
public Card(Drawable image) {}
};
public class Deck{
List<Card> cardList;
public Deck(){
for(int i=0; i<52; ++i){
cardList.add( new Card( ??? ) );
}
}
}
My question is, is there any way for me to generate references to the Drawable images of the card faces when constructing the Cards this way? Or do I need to find a different approach?