Saving/ Loading a file
Monkey Targets Forums/Android/Saving/ Loading a file
| ||
I am trying to get my Android app to save a file using...file.Open("monkey://internal/Coolgame.txt", "w") If Not file Print "Error: File not found for saving" Return Else file.WriteString pName End If Then load the file using... file.Open("monkey://internal/Coolgame.txt", "r") If Not file DebugLog "Error: File not found for loading" Return Else Local a:= 0 While Not file.Eof() fileStr[a] = file.ReadString() Print "fileStr[" + a + "]: " + fileStr[a] a = a + 1 Wend file.Close DebugLog "File opened successfully" End If I changed the AndroidManifest.xml permissions to... <uses-permission android:name="android.permission.READ_INTERAL_STORAGE" /> <uses-permission android:name="android.permission.WRITE_INTERNAL_STORAGE" /> When I run my app and click the appropriate buttons, all I get is the error messages from the code above. Any ideas? Thanks for any help! |
| ||
OK, I don't know what I was thinking, as usual, lol. To fix this you need to declare the file properly... file = FileStream.Open("monkey://internal/Coolgame.txt", "w") file = FileStream.Open("monkey://internal/Coolgame.txt", "r") Ugggh, sorry! |