Reputation: 590
I'm stuck with the following scenario and appreciate any help/advice..
What's the best way to store and retrieve this data (Strings and Icons), serverside or client side ? Is there a way to load icons dynamically at runtime, when I show the subcategories? (using http?)
Thanks in advance !
Upvotes: 0
Views: 978
Reputation: 66
You can load images dynamically as:
BitmapFactory.Options options = new BitmapFactory.Options();
options.outWidth= IMAGE_WIDTH;
options.outHeight= IMAGE_HEIGHT;
Bitmap bm = BitmapFactory.decodeFile("icon image file path", options);
imageView.setImageBitmap(bm);
In your case, you can download all the required icons on mobile's sdcard. So in future,if sub categories increases then you can download new icons for that and can dynamically render on UI.
Upvotes: 1
Reputation: 2478
Why would you fetch icon-data from a server? 20 * 30 = 600 icons. You probably will save hard drive space with respect to the installation. But personally I wouldn't go for that solution. If you're not in need of a client/server - approach then don't use it. What if the server for example breaks down, or you don't have an internet connection?. The application will then be useless :)
Upvotes: 1