I'm new in android and I'm working on a project where i'm using more than 50 images which includes icons and background images. As per android doc, for responsive UI I have to store each image in 4 format i.e. hdpi, mdpi, xdpi and xxdpi. I followed the same but after that I noticed that there are 200 images in my drawable folder(50*4). So my question is whether Im doing right thing or not? because it increases my project size.
-
1In this liknk , you can find more info : https://stackoverflow.com/questions/16351799/how-do-i-prepare-images-for-all-the-android-resolutions – Carlos Reyes Aug 17 '17 at 13:59
2 Answers
whether Im doing right thing?
Absolutely not if you store this 200 images inside your app than your app size is too much high and no one can download the app also there is some performance issue so this is not the right thing at all
Answer 1 -
Best way is to use fontawesome these will generate image from your ttf file dynamically you just need font.ttf file but disadvantages in this approach is there is less number of font/images available for free version if you want more number of images than you have to pay you can refer this
Answer 2 -
Go for Cloud storage means you need to store your image in one of cloud storage than download from cloud they provide API for upload as well as download images refer this But ill suggest you to go for cloudinary.com i have used this and easy to implement API , API for nearly all Languages and Its Free Free Free .......
Best of luck

- 3,647
- 3
- 35
- 55
-
Thanks Sushant! If I implement your 2nd answer then, is there any performance issue with app? Im asking this because we will call api to fetch every single image so every time calling api is feasible? – Omi Aug 17 '17 at 14:57
-
no there is no any performance issue if you use Picasso lib and many other also they provide you easy implementation for upload as well as download images and it didn't take too much of time just download and show in image view .....................this approach is highly prefer by most of company's – Sushant Gosavi Aug 18 '17 at 05:22
-
but ill would choose my first answer because there is no need to store as well as download image it is just simple textview and also you can dynamically create images whenever you want .....it gives you more flexibility to change image dynamically from server side ? did you understand this? – Sushant Gosavi Aug 18 '17 at 05:24
You have to try the vector drawable images. It contains the code path, so automatically it will expend to all size.
for more info
https://developer.android.com/guide/topics/graphics/vector-drawable-resources.html
https://developer.android.com/studio/write/vector-asset-studio.html

- 2,775
- 2
- 19
- 31
-
Thanks @Raja, I went through those links where they mention that Vector asset studio creates new xml file for every image. so in my case 50 xml files will be there. Is there other alternative way to do so which will reduce more size? – Omi Aug 17 '17 at 14:50
-
There is no other way.. the vector drawable image size is very low compare to .png and others, Some icon or symbols are use like string code(rupees symbol = "\u20B9") – Raja Aug 17 '17 at 15:03
-
But raja ..if i want to make complex image that it will take too much of time to create this kind of Vector Draw able is it feasible for large and complex images ?? – Sushant Gosavi Aug 18 '17 at 05:19