CoderInside
CoderInside

Reputation: 473

Best practice in Android for huge drawable resource images App

I need to build a simple game that will show an image on Demand of users. This game will use a high amount of images more than 800 jpg from 15k to 20k.

Is it recommended to set this amount of images in Drawable folder? The read speed it's not relevant.

And If I want this game work for different Screen sizes, Do I have to multiply these images for each screen size?

Thanks.

Upvotes: 1

Views: 747

Answers (1)

T D Nguyen
T D Nguyen

Reputation: 7603

800 jpg images should have around 16MB and it is not very big for a game even if you want it to be 40MB for 3 more different screen sizes. However if you want to keep it small, you can try this approach:

  1. Store all images for largest screen size that you wanna support in Drawable folder (Each image have only one version)
  2. When user open game for the first time, detect screen size (resolution) and resize all those images and save it to local storage (cache) of app. Or resize and save on demand (refer: How to resize an image to fit multiple screen densities)
  3. Use images from cache for game.

Upvotes: 1

Related Questions