11-08-2012 12:04 PM
I am storing configuration data of various sorts in persistent storage XML definitions and other String data.
This data is read from a server when the app is installed and can also be requested by the user.
It is stored in a hashtable for simple retrieval and the hashtables are saved in persistable storage, Works nice.
Except for storing images that come in the format og png files and these are not persistable. Discovered that the hard way :-)
Is there a way to circumvent this problem? All this data comes in a zip file from the server and all is unzipped to the SDCard. So is there a way to "transform" or "wrap" these png files so they can be saved in persistent storage? Saving them on the SD Card is ok for a temporary storage but for "permanent" storage I would like to keep them in persistent storage.
Solved! Go to Solution.
11-08-2012 04:39 PM - edited 11-08-2012 05:19 PM
I see that there is a possibillity to convert the image to string
String work = img.toString()
Can I get back the image from String?
Is byte persistable? In that case I can save the byte file in the hashtable instead and skip the statement
"Image img2 = Image.createImage(bytedata,0, bytedata.length);"
until later when I need the image?
11-08-2012 06:14 PM
11-08-2012 06:22 PM
Arrays are persistable. At least String and long arrays. I use them already. Yoursuggestion about storing on the SD-card is valid. Complicates thing a bit only.
11-09-2012 04:18 AM
11-09-2012 05:33 AM
Tried byte. works fine.
I will generalize and use byte for both configs, xml-strings and Images when storing in hashtable since all are retrieved from the SDcard in byte format initially. When retrieving I convert to String or Image.