I will create a simple floor map guide. I have different FLOORS and the corresponding MAPS. FLOORS are buttons and MAPS are png files stored in the sdcard. When I click 1F and corresponding 1Fmap will be displayed and so with other floors.
I am thinking of the following:
- one image view to show the selected map.
- Hashmap ( OR ) to handle the bitmaps. use to obtain the bitmap based on the selected floor. then set to ImageView via setImageBitmap(..)
- the bitmap to be assigned in the Hashmap are downloaded upon clicking of the floor button. then create the bitmap, set to imageview and the later on store to hashmap upon clicking the other floors.
Here are my technical/design problems:
- how to create a copy of bitmap?
- is it ok to store it to hashmap gradually or obtain it from the sdcard everytime the floor buttons are click?
- if i will be using hashmap, is it ok to use Integer (floor numbers) or String (floornames) as map key?
UPDATE:
additional, I am targeting maximum of 20 floors (it means 20 512×512 png files…i am thinking also to adjust it to 256×256 as others suggested).
To create copy of bitmap you can use:
Bitmap newBmp = Bitmap.createScaledBitmap(src, dstWidth, dstHeight, filter);You can gradually get the Image from SD card. NO problem with this implementation.
If you are using Hashmap then you can user the image URL as the Key for Hashmap.