Save images together with other data in XML | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Save images together with other data in XML

I am developing a game in Android Studio. Some of the sprites I use need to have some pre-defined image points when I load them in the game. So, currently, I am saving the image points (using a PC program I wrote), and all other data with them, in xml files. When I load the images, I put them in an array. The xml file contains the index of its image from the array, and that's how it works. But I don't like it. Is there a better way to load both the image and its data together?

28th Feb 2019, 3:03 PM
Robert Sokolov
Robert Sokolov - avatar
3 Answers
1st Mar 2019, 11:36 AM
KrOW
KrOW - avatar
+ 3
You could define your format than store either in a single file then use a custom loader for any of these resources to load
28th Feb 2019, 3:37 PM
KrOW
KrOW - avatar
+ 1
I can easily solve this by loading the images using the filename. I had googled whether it is possible before, and read that images are bundled in the APK and that it is impossible to load them from the file path. For some reason, when I googled it up today, it turned out that it's actually possible... Is it?
1st Mar 2019, 11:05 AM
Robert Sokolov
Robert Sokolov - avatar