i’m developing app which at some point display images. I’ve noticed that in resources there are few versions of application icon in various resolutions. Since i store my images in database i wonder if it would be better for me to keep few versions of my image in diffrent resolutions.Reasons for it are obvious, app speed, memory use, the only con is bigger app size due to more data. Fetching images is not a problem, i just have no clue when to know which of version of image get and how to determine it? Or maybe just keep some larger image size and let the system handle resizing cause it isn’t so much stress on device?
Other thing is that I keep my images in database, i wonder if it’s more efficient diskspace/cpu/memory use/speed to keep these images in db, or keep their names there only, keeping images as resources in dpi folders corresponding to their size?
If you don’t have too many images, I would highly suggest using the automated resource loading that you get with the resource folders.
As for what constitutes “too many images”- it’s really up to you. I personally think that if you can fit all the images within the APK size limit (50MB), then you should.
You also asked about which size images should target which screen sizes. For this, you should peruse the Support Multiple Screen Sizes documentation. Specifically, the range of screen sizes supported section will provide guidance on the pixel densities you can target. Keep in mind that you aren’t target screen sizes- you are targeting screen densities.
As you pointed out, you can also just upload the highest resolution image you have, and let the system take care of it. This is possible, but will result in your app loading a little more slowly than it needs to on lower-density screens.
I can’t comment on your database method, as I don’y have any specifics on your implementation, but if it is a remote database that you have to fetch images from over the internet, then I would definitely recommend putting your images in the resource files. Going over the internet for these resources is slow and wastes the user’s valuable bandwidth.