Search code examples
javaeclipseimageplaying-cards

What is the best way to include cards images in my app?


I'm writing an android app in java and in one of my activities I want to use a pack of 52 cards, and display a few of them randomly. Do I need to download and keep 52 images or is there other way of doing it?

I want to display different cards, randomly chosen. How can I get those images?


Solution

  • I can think of 3 ways of doing this:

    1. Have a different image file for each card.
    2. Have one large image of all cards and only draw a part of the image for each card.
    3. Build the image of a card having several small images of the parts of a card.

    If you're looking to save space on the device I would suggest number 3.

    You would need images of the 4 suits, the faces(J,Q,K) and the blank card. The numbers and letters could simply be written in red and black.