[Android] Weird LoadString behaviour
Monkey Forums/Monkey Bug Reports/[Android] Weird LoadString behaviour
| ||
Hi, I was building my app for Android and noticed that LoadString sometimes returns an empty string, although the file exists and doesn't contain any unusual characters. The following code loads both text files correctly on all other targets (except iOS and PSM, which I didn't try): Import mojo Class Text Extends App Field txt1:String, txt2:String Method OnCreate() SetUpdateRate 60 txt1 = LoadString("text_1.txt") txt2 = LoadString("text_2.txt") End Method OnRender() Cls DrawText txt1 + ", Length: " + txt1.Length, 10, 10 DrawText txt2 + ", Length: " + txt2.Length, 10, 30 End End Function Main() New Text End Here are the two text files that I used. The first one is loaded correctly, but for some reason, the second one results in an empty string. This text has two lines. ABC DEF GHI! This text has two lines. Next line! Note: Compiled on Windows for the Android Emulator using Monkey Pro V64(b) EDIT: Output on xna, glfw, html5, flash: This text has two lines. ABC DEF GHI!, Length: 38 This text has two lines. Next line!, Length: 36 Output on android: This text has two lines. ABC DEF GHI!, Length: 38 , Length: 0 |
| ||
Hi, Works here on both emulator and a Nexus 7 with 64b. Have you definitely updated to 64b? Have you deleted .build dir? If all else fails, please email me the EXACT code. |
| ||
Thanks for your reply, Mark. I did all of the above and it didn't work, but I finally solved the problem by using the "Wipe user data" option when starting the emulator. Maybe one of the text files wasn't copied correctly to the device. |